/* ============================================================
   Axion Office - UI styles
   ============================================================ */
:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--sidebar);
    color: #cbd5e1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 0;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 20px 20px;
    font-weight: 700; font-size: 16px; color: #fff;
}
.brand-mark {
    display: inline-grid; place-items: center;
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--primary); color: #fff; font-weight: 800;
}
.brand-mark.lg { width: 48px; height: 48px; font-size: 22px; margin: 0 auto 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: #cbd5e1; text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }
.ico { width: 18px; text-align: center; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.bell { cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar { font-size: 18px; }
.logout { color: var(--muted); font-size: 13px; }

.content { padding: 24px; max-width: 1200px; width: 100%; }

/* ---------- Dashboard ---------- */
.greeting { margin: 0 0 20px; font-size: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-grid.one { grid-template-columns: 1fr; max-width: 320px; }
.stat-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.stat-card.income  { border-left-color: var(--green); }
.stat-card.expense { border-left-color: var(--red); }
.stat-card.balance { border-left-color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.dash-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) {
    .dash-columns { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr; }
    .sidebar { width: 64px; }
    .brand-name, .nav-link span:not(.ico) { display: none; }
}

/* ---------- Panels & tables ---------- */
.panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 20px; overflow: hidden;
}
.panel.pad { padding: 20px; }
.pad { padding: 20px; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel h3 { margin-top: 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.text-right { text-align: right; }
.strong { font-weight: 600; }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Chart ---------- */
.chart { padding: 20px; }
.bars { display: flex; align-items: flex-end; gap: 16px; height: 180px; padding-bottom: 8px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; }
.bar { width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-in { background: var(--green); }
.bar-out { background: var(--red); }
.bar-label { font-size: 11px; color: var(--muted); margin-top: 6px; }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.dot-in { background: var(--green); } .dot-out { background: var(--red); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: capitalize;
    background: #e2e8f0; color: #475569;
}
.badge-paid { background: #dcfce7; color: #166534; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-cancelled { background: #f3f4f6; color: #6b7280; }
.badge-invoice { background: #dcfce7; color: #166534; }
.badge-expense { background: #fee2e2; color: #991b1b; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px;
    border: 1px solid var(--border); background: #fff; color: var(--text);
    font-weight: 500; cursor: pointer; font-size: 14px; text-decoration: none;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 8px; }
.btn-icon:hover { color: var(--red); }

/* ---------- Forms ---------- */
.form label { display: block; margin-bottom: 14px; font-weight: 500; font-size: 13px; }
.form input, .form select, .form textarea {
    display: block; width: 100%; margin-top: 5px;
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.col-span-2 { grid-column: span 2; }
.form-actions { margin-top: 8px; }
.mt { margin-top: 18px; }

/* ---------- Page heads ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 20px; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.searchbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.searchbar input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; }
.quick-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.link { color: var(--primary); font-size: 13px; }

/* ---------- Detail list ---------- */
.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; }

/* ---------- Invoice ---------- */
.items-table input { margin: 0; }
.totals { margin-top: 18px; margin-left: auto; max-width: 300px; }
.totals > div { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { border-top: 2px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 16px; }
.invoice-parties { display: flex; justify-content: space-between; gap: 20px; }

/* ---------- Email ---------- */
.mail-table tr.unread { font-weight: 600; }
.mail-from { width: 220px; }
.mail-date { width: 140px; color: var(--muted); }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Calendar ---------- */
.event-list { padding: 8px; }
.event-item {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border-bottom: 1px solid var(--border);
}
.event-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.event-body { flex: 1; }
.event-title { font-weight: 600; }
.event-time { color: var(--muted); font-size: 12px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Auth ---------- */
body.centered { display: grid; place-items: center; min-height: 100vh; background: var(--sidebar); }
.auth-card {
    background: #fff; border-radius: 14px; padding: 34px;
    width: 360px; box-shadow: 0 20px 40px rgba(0,0,0,.3); text-align: center;
}
.auth-card .form { text-align: left; margin-top: 20px; }
.auth-brand h1 { margin: 6px 0 2px; font-size: 22px; }
.auth-card h1 { font-size: 22px; }

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .head-actions, .quick-actions { display: none !important; }
    .content { padding: 0; }
    .panel { box-shadow: none; border: none; }
}
