@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;700&display=swap');

:root {
  --navy:       #0f2444;
  --navy-mid:   #1a3a5c;
  --navy-light: #234e7a;
  --gold:       #c49a30;
  --gold-dim:   rgba(196,154,48,0.12);
  --gold-border:rgba(196,154,48,0.3);
  --text:       #1e293b;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --white:      #ffffff;
  --bg:         #f1f5f9;
  --surface:    #f8fafc;
  --green:      #16a34a;
  --green-dim:  rgba(22,163,74,0.1);
  --amber:      #d97706;
  --amber-dim:  rgba(217,119,6,0.1);
  --red:        #dc2626;
  --red-dim:    rgba(220,38,38,0.1);
  --blue:       #2563eb;
  --blue-dim:   rgba(37,99,235,0.1);
  --shadow:     0 2px 12px rgba(15,36,68,0.08);
  --shadow-lg:  0 8px 32px rgba(15,36,68,0.14);
  --radius:     8px;
  --radius-lg:  12px;
  --sidebar-w:  240px;
  --t:          0.18s ease;
  --font-d:     'Playfair Display', Georgia, serif;
  --font-b:     'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-b); color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── LOGIN PAGE ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  background-image: radial-gradient(ellipse at 70% 30%, rgba(196,154,48,0.12) 0%, transparent 55%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 44px 40px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo-name { font-family: var(--font-d); font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.login-logo-name span { color: var(--gold); }
.login-logo-sub { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 4px; }
.login-title { font-size: 1rem; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 0.82rem; color: var(--muted); text-align: center; margin-bottom: 28px; }
.l-group { margin-bottom: 16px; }
.l-group label { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text); margin-bottom: 6px; }
.l-group input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 11px 14px; font-size: 0.9rem; outline: none; transition: border var(--t);
}
.l-group input:focus { border-color: var(--navy); }
.login-btn {
  width: 100%; background: var(--navy); color: var(--white); border: none;
  border-radius: var(--radius); padding: 13px; font-size: 0.9rem; font-weight: 700;
  margin-top: 8px; transition: background var(--t);
}
.login-btn:hover { background: var(--navy-mid); }
.login-error { display: none; background: var(--red-dim); border: 1px solid rgba(220,38,38,0.25); border-radius: var(--radius); padding: 10px 14px; font-size: 0.82rem; color: var(--red); margin-top: 14px; text-align: center; }
.login-error.show { display: block; }
.login-demo { font-size: 0.75rem; color: var(--muted); text-align: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.login-demo code { background: var(--bg); padding: 2px 7px; border-radius: 4px; font-size: 0.72rem; }

/* ── DASHBOARD LAYOUT ────────────────────────────────────────────── */
.dash-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--navy); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-logo { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo-name { font-family: var(--font-d); font-size: 1.1rem; font-weight: 700; color: var(--white); display: block; }
.sidebar-logo-name span { color: var(--gold); }
.sidebar-logo-sub { font-size: 0.62rem; color: rgba(255,255,255,0.35); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 3px; display: block; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius); font-size: 0.85rem; font-weight: 500;
  color: rgba(255,255,255,0.55); transition: all var(--t); cursor: pointer;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.sidebar-nav a.active { background: rgba(196,154,48,0.18); color: var(--gold); }
.sidebar-nav .nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-section-label { font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.2); padding: 14px 12px 4px; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.sidebar-avatar { width: 32px; height: 32px; background: var(--gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--navy); flex-shrink: 0; }
.sidebar-user-name { font-size: 0.82rem; font-weight: 600; color: var(--white); }
.sidebar-user-role { font-size: 0.7rem; color: rgba(255,255,255,0.35); }
.logout-btn { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius); font-size: 0.82rem; color: rgba(255,255,255,0.4); transition: color var(--t); background: none; border: none; width: 100%; margin-top: 4px; }
.logout-btn:hover { color: var(--white); }

/* Main area */
.dash-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Top bar */
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 28px; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 0.78rem; color: var(--muted); }

/* Content area */
.dash-content { padding: 28px; flex: 1; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius); border: none; font-size: 0.83rem; font-weight: 600; transition: all var(--t); cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: #d4a93a; }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-mid); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(220,38,38,0.2); }
.btn-danger:hover { background: var(--red); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-icon { padding: 7px; border-radius: var(--radius); background: transparent; border: 1.5px solid var(--border); color: var(--muted); font-size: 0.9rem; transition: all var(--t); }
.btn-icon:hover { border-color: var(--navy); color: var(--navy); }

/* ── Overview cards ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.stat-icon.gold { background: var(--gold-dim); }
.stat-icon.green { background: var(--green-dim); }
.stat-icon.amber { background: var(--amber-dim); }
.stat-icon.blue  { background: var(--blue-dim); }
.stat-num { font-family: var(--font-d); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-sub { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* ── Page header ─────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-header h2 { font-family: var(--font-d); font-size: 1.35rem; color: var(--navy); font-weight: 700; }
.page-header-actions { display: flex; gap: 8px; }

/* ── Filters bar ─────────────────────────────────────────────────── */
.filters-bar { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap input { width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 9px 12px 9px 34px; font-size: 0.85rem; outline: none; transition: border var(--t); }
.search-wrap input:focus { border-color: var(--navy); }
.search-wrap::before { content: ''; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat; }
.filter-select { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 9px 30px 9px 12px; font-size: 0.83rem; background: var(--white); color: var(--text); outline: none; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3e%3cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; transition: border var(--t); }
.filter-select:focus { border-color: var(--navy); }

/* ── Client table ────────────────────────────────────────────────── */
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface); }
th { padding: 11px 16px; text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
td { padding: 13px 16px; border-top: 1px solid var(--border); font-size: 0.85rem; vertical-align: middle; }
tr:hover td { background: var(--surface); }
.td-name { font-weight: 600; color: var(--navy); }
.td-sub  { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.td-actions { display: flex; gap: 6px; }

/* Status badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-active    { background: var(--green-dim); color: var(--green); }
.badge-active::before  { background: var(--green); }
.badge-pending   { background: var(--amber-dim); color: var(--amber); }
.badge-pending::before { background: var(--amber); }
.badge-review    { background: var(--blue-dim);  color: var(--blue);  }
.badge-review::before  { background: var(--blue); }
.badge-complete  { background: rgba(100,116,139,0.1); color: var(--muted); }
.badge-complete::before{ background: var(--muted); }
.badge-urgent    { background: var(--red-dim); color: var(--red); }
.badge-urgent::before  { background: var(--red); }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(10,18,38,0.55); z-index: 300; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 22px 26px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--white); z-index: 1; }
.modal-header h3 { font-family: var(--font-d); font-size: 1.1rem; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--muted); line-height: 1; padding: 2px 6px; border-radius: 4px; transition: color var(--t); }
.modal-close:hover { color: var(--navy); }
.modal-body { padding: 22px 26px; }
.modal-footer { padding: 16px 26px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.m-group { margin-bottom: 14px; }
.m-group label { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text); margin-bottom: 5px; }
.m-group input, .m-group select, .m-group textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 10px 13px; font-size: 0.88rem; outline: none; transition: border var(--t);
  color: var(--text); background: var(--white);
}
.m-group input:focus, .m-group select:focus, .m-group textarea:focus { border-color: var(--navy); }
.m-group select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3e%3cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.m-group textarea { resize: vertical; min-height: 72px; }
.m-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Client detail panel ─────────────────────────────────────────── */
.detail-header { display: flex; align-items: center; gap: 16px; padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.detail-avatar { width: 52px; height: 52px; background: var(--navy); color: var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-d); font-size: 1.1rem; font-weight: 700; flex-shrink: 0; }
.detail-name { font-family: var(--font-d); font-size: 1.15rem; color: var(--navy); font-weight: 700; line-height: 1.2; }
.detail-sub  { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.detail-field label { display: block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.detail-field span { font-size: 0.88rem; color: var(--text); }
.notes-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 0.85rem; color: var(--text); line-height: 1.7; min-height: 70px; white-space: pre-wrap; }

/* ── Recent activity ─────────────────────────────────────────────── */
.recent-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-top: 0; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 0.88rem; font-weight: 700; color: var(--navy); }
.card-body { padding: 6px 0; }
.activity-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; background: var(--gold); border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 0.83rem; color: var(--text); line-height: 1.5; }
.activity-time { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.deadline-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.deadline-item:last-child { border-bottom: none; }
.deadline-date { text-align: center; flex-shrink: 0; min-width: 42px; }
.deadline-date .dd-day  { font-family: var(--font-d); font-size: 1.2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.deadline-date .dd-mon  { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }
.deadline-info { flex: 1; }
.deadline-client { font-size: 0.83rem; font-weight: 600; color: var(--navy); }
.deadline-task   { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .es-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.88rem; }

/* ── Toast ───────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--navy); color: var(--white); padding: 10px 22px; border-radius: 40px; font-size: 0.85rem; font-weight: 500; opacity: 0; pointer-events: none; z-index: 999; white-space: nowrap; box-shadow: var(--shadow-lg); transition: all 0.22s ease; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .recent-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .dash-content { padding: 18px; }
  .topbar { padding: 0 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 2px 0; }
  td { border: none; border-bottom: 1px solid var(--border); padding: 9px 14px; }
  td:last-child { border-bottom: none; }
  td::before { content: attr(data-label); display: block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
  .m-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}


/* ── SVG icon rendering (emoji replacements) ───────────────────── */
.nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg, .stat-icon svg, .btn-icon svg, .es-icon svg, .logout-btn svg { display: block; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.es-icon { color: var(--muted); display: flex; align-items: center; justify-content: center; }
.stat-icon.gold  { color: var(--gold); }
.stat-icon.green { color: #16a34a; }
.stat-icon.amber { color: var(--amber); }
.stat-icon.blue  { color: var(--blue); }
.stat-icon.red   { color: var(--red); }
.logout-btn svg, #viewDeleteBtn svg, #viewEditBtn svg { flex-shrink: 0; }
