/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

.ci-wrap {
	max-width: 960px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: #1f2937;
}

/* ── Auth page ── */
.ci-auth-wrap {
	max-width: 420px;
	margin: 30px auto;
}

.ci-auth-header {
	text-align: center;
	margin-bottom: 20px;
}

.ci-auth-header h2 {
	font-size: 22px;
	font-weight: 800;
	color: #1e40af;
	margin-bottom: 4px;
}

.ci-auth-header p {
	color: #6b7280;
	font-size: 13px;
}

.ci-auth-card {
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(0,0,0,0.10);
	overflow: hidden;
}

.ci-auth-card .ci-btn,
.ci-auth-card button.ci-btn {
	background-color: #1d4ed8 !important;
	color: #ffffff !important;
	border: 2px solid #1d4ed8 !important;
	display: flex;
	width: 100%;
	justify-content: center;
	padding: 11px 20px;
	font-size: 15px;
	font-weight: 700;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none !important;
	margin-top: 4px;
}

.ci-auth-card .ci-btn:hover,
.ci-auth-card button.ci-btn:hover {
	background-color: #1e3a8a !important;
	color: #ffffff !important;
}

.ci-form-actions .ci-btn,
.ci-form-actions button.ci-btn {
	background-color: #1d4ed8 !important;
	color: #ffffff !important;
	border: 2px solid #1d4ed8 !important;
}

.ci-form-actions .ci-btn:hover {
	background-color: #1e3a8a !important;
	color: #ffffff !important;
}

.ci-auth-switch {
	text-align: center;
	font-size: 13px;
	color: #6b7280;
	padding: 0 24px 20px;
	margin: 0;
}

.ci-auth-switch a {
	color: #2563eb;
	font-weight: 600;
	text-decoration: none;
}

.ci-remember {
	display: flex !important;
	align-items: center;
	gap: 8px;
	font-weight: normal !important;
	font-size: 13px;
	cursor: pointer;
}

.ci-remember input {
	width: auto !important;
	margin: 0 !important;
}

/* ── Tabs ── */
.ci-tabs {
	display: flex;
	background: #f8faff;
	border-bottom: 2px solid #e5e7eb;
}

.ci-auth-card .ci-tabs {
	border-bottom: 2px solid #e5e7eb;
}

.ci-tab {
	flex: 1;
	text-align: center;
	padding: 13px 16px;
	font-size: 14px;
	font-weight: 600;
	color: #6b7280;
	text-decoration: none;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	transition: color .15s, border-color .15s;
}

.ci-tab.active {
	color: #2563eb;
	border-bottom-color: #2563eb;
	background: #fff;
}

.ci-tab:hover:not(.active) {
	color: #374151;
}

/* ── Notices ── */
.ci-notice-success {
	background: #ecfdf5;
	color: #065f46;
	border: 1px solid #6ee7b7;
	border-radius: 8px;
	padding: 12px 16px;
	margin: 16px 0;
	font-size: 14px;
	font-weight: 500;
}

.ci-error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fca5a5;
	border-radius: 8px;
	padding: 12px 16px;
	margin: 12px 0;
	font-size: 13px;
}

.ci-error p { margin: 3px 0; }

/* ── Summary cards ── */
.ci-summary-cards {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 20px;
}

.ci-card {
	border-radius: 10px;
	padding: 14px 16px;
	color: #fff;
}

.ci-card-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .5px;
	opacity: .85;
	margin-bottom: 6px;
}

.ci-card-value {
	font-size: 20px;
	font-weight: 800;
	letter-spacing: -.5px;
}

.ci-card-blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.ci-card-green  { background: linear-gradient(135deg, #059669, #047857); }
.ci-card-yellow { background: linear-gradient(135deg, #d97706, #b45309); }
.ci-card-gray   { background: linear-gradient(135deg, #6b7280, #4b5563); }

/* ── Toolbar ── */
.ci-toolbar {
	display: flex;
	gap: 10px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

/* ── Buttons — use high specificity to beat theme overrides ── */
.ci-wrap .ci-btn,
.ci-wrap a.ci-btn,
.ci-wrap button.ci-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none !important;
	transition: background .15s, transform .1s, box-shadow .15s;
	border: 2px solid transparent;
	line-height: 1.4;
}

/* Primary — white text on blue */
.ci-wrap .ci-btn-primary,
.ci-wrap a.ci-btn-primary {
	background-color: #1d4ed8 !important;
	color: #ffffff !important;
	border-color: #1d4ed8 !important;
	box-shadow: 0 2px 8px rgba(29,78,216,.30);
}
.ci-wrap .ci-btn-primary:hover,
.ci-wrap a.ci-btn-primary:hover {
	background-color: #1e3a8a !important;
	color: #ffffff !important;
	border-color: #1e3a8a !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(29,78,216,.40);
}

/* Secondary Alt — dark text on white with visible border */
.ci-wrap .ci-btn-secondary-alt,
.ci-wrap a.ci-btn-secondary-alt {
	background-color: #ffffff !important;
	color: #1d4ed8 !important;
	border-color: #1d4ed8 !important;
	box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.ci-wrap .ci-btn-secondary-alt:hover,
.ci-wrap a.ci-btn-secondary-alt:hover {
	background-color: #eff6ff !important;
	color: #1e3a8a !important;
	border-color: #1e3a8a !important;
	transform: translateY(-1px);
}

/* Generic fallback */
.ci-wrap .ci-btn:not(.ci-btn-primary):not(.ci-btn-secondary-alt):not(.ci-btn-outline):not(.ci-btn-sm) {
	background-color: #1d4ed8 !important;
	color: #ffffff !important;
}

.ci-wrap .ci-btn-outline {
	background-color: #ffffff !important;
	color: #1d4ed8 !important;
	border-color: #1d4ed8 !important;
}
.ci-wrap .ci-btn-outline:hover {
	background-color: #eff6ff !important;
}

.ci-wrap .ci-btn-block { width: 100%; }
.ci-wrap .ci-btn-sm    { padding: 7px 14px; font-size: 13px; }
.ci-wrap .ci-btn-lg    { padding: 13px 28px; font-size: 15px; }

/* ── Empty state ── */
.ci-empty {
	text-align: center;
	padding: 48px 20px;
	background: #f9fafb;
	border-radius: 12px;
	border: 2px dashed #e5e7eb;
	color: #6b7280;
	font-size: 15px;
}

/* ── Table ── */
.ci-table-wrap {
	overflow-x: auto;
	border-radius: 10px;
	border: 1px solid #e5e7eb;
}

.ci-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 600px;
}

.ci-table th {
	background: #1e40af;
	color: #fff;
	padding: 11px 14px;
	font-size: 12px;
	font-weight: 700;
	text-align: left;
	text-transform: uppercase;
	letter-spacing: .4px;
}

.ci-table td {
	padding: 11px 14px;
	font-size: 13px;
	border-bottom: 1px solid #f3f4f6;
}

.ci-table tbody tr:hover { background: #f8faff; }
.ci-table tbody tr:last-child td { border-bottom: none; }

/* Badges */
.ci-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
}

.ci-badge-green  { background: #d1fae5; color: #065f46; }
.ci-badge-yellow { background: #fef3c7; color: #92400e; }
.ci-badge-gray   { background: #f3f4f6; color: #374151; }

.ci-type-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 600;
}

.ci-type-invoice  { background: #dbeafe; color: #1e40af; }
.ci-type-estimate { background: #ede9fe; color: #5b21b6; }

/* Action buttons */
.ci-actions { white-space: nowrap; }

.ci-action-btn {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 5px;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
	margin-right: 4px;
	background: #f3f4f6;
	color: #374151;
	transition: background .12s;
}

.ci-action-btn:hover   { background: #e5e7eb; color: #111827; }
.ci-action-preview         { background: #eff6ff; color: #1d4ed8; }
.ci-action-preview:hover   { background: #dbeafe; color: #1e40af; }
.ci-action-copy            { background: #f0fdf4; color: #166534; }
.ci-action-copy:hover      { background: #dcfce7; color: #14532d; }
.ci-action-del             { background: #fef2f2; color: #dc2626; }
.ci-action-del:hover       { background: #fee2e2; color: #b91c1c; }

/* ── Form ── */
.ci-form-header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 20px;
}

.ci-form-header h3 {
	font-size: 20px;
	font-weight: 800;
	color: #1e40af;
	margin: 0;
}

.ci-back {
	font-size: 13px;
	color: #2563eb;
	text-decoration: none;
	font-weight: 600;
	white-space: nowrap;
}

.ci-back:hover { text-decoration: underline; }

.ci-section {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 18px 20px;
	margin-bottom: 14px;
}

.ci-section-title {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: #6b7280;
	margin-bottom: 14px;
	padding-bottom: 8px;
	border-bottom: 1px solid #f3f4f6;
}

.ci-form label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 12px;
}

.ci-form input[type="text"],
.ci-form input[type="email"],
.ci-form input[type="date"],
.ci-form input[type="number"],
.ci-form input[type="password"],
.ci-form textarea,
.ci-form select {
	width: 100%;
	margin-top: 5px;
	padding: 9px 12px;
	border: 1.5px solid #d1d5db;
	border-radius: 7px;
	font-size: 14px;
	font-weight: 400;
	color: #1f2937;
	background: #fff;
	transition: border-color .15s, box-shadow .15s;
	font-family: inherit;
}

.ci-form input:focus,
.ci-form textarea:focus,
.ci-form select:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.ci-form textarea { resize: vertical; }

.ci-auth-card .ci-form {
	padding: 20px 24px;
}

.ci-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ci-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Line items ── */
.ci-items-table {}
.ci-items-head {
	display: grid;
	grid-template-columns: 3fr .7fr 1.1fr 1fr .6fr 1fr auto;
	gap: 6px;
	padding: 7px 10px;
	background: #1e40af;
	border-radius: 7px 7px 0 0;
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	text-transform: uppercase;
	letter-spacing: .4px;
	align-items: center;
}

.ci-item-row {
	display: grid;
	grid-template-columns: 3fr .7fr 1.1fr 1fr .6fr 1fr auto;
	gap: 6px;
	align-items: start;
	padding: 6px 10px;
	border: 1px solid #e5e7eb;
	border-top: none;
	background: #fff;
}

.ci-item-row:nth-child(even) { background: #f8faff; }

.ci-item-row input,
.ci-item-row textarea,
.ci-item-row select {
	padding: 7px 8px;
	border: 1.5px solid #d1d5db;
	border-radius: 6px;
	font-size: 12px;
	font-family: inherit;
	width: 100%;
	transition: border-color .15s;
}

.ci-item-row input:focus,
.ci-item-row textarea:focus,
.ci-item-row select:focus {
	outline: none;
	border-color: #2563eb;
}

.ci-item-row textarea { resize: vertical; min-height: 42px; }

.ci-line-total {
	font-size: 13px;
	font-weight: 700;
	color: #1e40af;
	padding-top: 9px;
	white-space: nowrap;
}

.ci-remove-row {
	background: #fef2f2;
	color: #dc2626;
	border: 1.5px solid #fca5a5;
	border-radius: 6px;
	width: 30px;
	height: 30px;
	margin-top: 6px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	transition: background .12s;
}

.ci-remove-row:hover { background: #fee2e2; }

/* ── Totals section ── */
.ci-totals-section {
	display: flex;
	gap: 20px;
	align-items: flex-start;
	flex-wrap: wrap;
}

.ci-tax-row { flex: 1; min-width: 180px; }

.ci-totals-box {
	min-width: 240px;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
}

.ci-total-line {
	display: flex;
	justify-content: space-between;
	padding: 8px 14px;
	font-size: 13px;
	border-bottom: 1px solid #f3f4f6;
}

.ci-grand-total {
	background: #1e40af;
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	border-bottom: none;
}

/* ── Form actions ── */
.ci-form-actions {
	margin-top: 6px;
	padding-top: 16px;
	border-top: 2px solid #f3f4f6;
}

/* ── Help text ── */
.ci-help {
	font-weight: 400;
	font-size: 11px;
	color: #9ca3af;
}

/* ── Logo preview ── */
.ci-logo-preview {
	margin: 8px 0;
}

.ci-logo-preview img {
	max-height: 70px;
	max-width: 200px;
	display: block;
	border: 1.5px solid #e5e7eb;
	border-radius: 6px;
	padding: 6px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
	.ci-summary-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
	.ci-summary-cards { grid-template-columns: 1fr 1fr; }
	.ci-grid,
	.ci-grid-3 { grid-template-columns: 1fr; }

	.ci-items-head { display: none; }

	.ci-item-row {
		grid-template-columns: 1fr 1fr;
		gap: 6px;
		padding: 10px;
		border: 1px solid #e5e7eb;
		border-radius: 8px;
		margin-bottom: 8px;
		border-top: 1px solid #e5e7eb;
	}

	.ci-item-row textarea { grid-column: 1 / -1; }

	.ci-table thead { display: none; }
	.ci-table, .ci-table tbody, .ci-table tr, .ci-table td { display: block; width: 100%; }
	.ci-table tr { margin-bottom: 12px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; }
	.ci-table td { border-bottom: none; padding: 4px 6px; }
	.ci-table td::before { content: attr(data-label) ': '; font-weight: 700; color: #374151; }

	.ci-totals-section { flex-direction: column; }
	.ci-totals-box { width: 100%; }
}


/* Mobile responsive improvements */
.ci-wrap, .ci-container { max-width:100%; box-sizing:border-box; }
.ci-table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.ci-card, .ci-form, .ci-box { box-sizing:border-box; }
@media(max-width:768px){
 .ci-grid, .ci-columns { display:block !important; }
 .ci-form input, .ci-form textarea, .ci-form select { width:100% !important; max-width:100%; font-size:16px; }
 .ci-actions, .ci-buttons { flex-direction:column; gap:10px; }
 .ci-actions button, .ci-buttons button, .ci-buttons a { width:100%; text-align:center; }
 table.ci-table { min-width:650px; }
 .ci-mobile-stack { display:block !important; }
}

/* Modern mobile dashboard improvements */
.ci-card, .ci-form, .ci-panel {
    border-radius: 16px;
    padding: 18px;
    background:#fff;
    box-shadow:0 8px 24px rgba(15,23,42,.08);
}
.ci-btn, button[type=submit] {
    border-radius:10px !important;
    padding:12px 18px !important;
    font-weight:700;
}
@media(max-width:600px){
    .ci-card, .ci-form, .ci-panel { padding:14px; }
    input,select,textarea { width:100% !important; font-size:16px !important; }
    table { display:block; overflow-x:auto; }
    .ci-btn { width:100%; margin-top:8px; }
}

/* Pro dashboard additions */
.ci-search{width:100%;max-width:360px;padding:12px 14px;border:1px solid #d1d5db;border-radius:10px;margin:10px 0;font-size:15px}
.ci-quick-actions{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:15px}
.ci-table tr.hidden-row{display:none}
.ci-card{border-radius:14px!important;box-shadow:0 6px 20px rgba(0,0,0,.08)}
@media(max-width:600px){.ci-search{max-width:100%}.ci-quick-actions a{width:100%;text-align:center}}

@media(max-width:700px){
.ci-summary-cards{grid-template-columns:1fr 1fr;}
.ci-toolbar .ci-btn{width:100%;}
.ci-table{overflow-x:auto;}
.ci-table table{min-width:700px;}
}
