@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --brand:    #1a56db;
  --brand-dk: #1140a6;
  --font:     'DM Sans', system-ui, sans-serif;
  --mono:     'DM Mono', monospace;
  --r:  10px;
  --rl: 14px;
  --rx: 20px;
  --bg:  #f9f8f6;
  --bg2: #ffffff;
  --bg3: #f1efe8;
  --bg4: #e8e6df;
  --text:  #1a1a18;
  --text2: #5f5e5a;
  --text3: #888780;
  --b:  rgba(0,0,0,0.1);
  --b2: rgba(0,0,0,0.18);
  --b3: rgba(0,0,0,0.28);
  --sw: 220px;
}
@media (prefers-color-scheme:dark) {
  :root {
    --bg:#1a1a18; --bg2:#242422; --bg3:#0f0f0e; --bg4:#1f1f1d;
    --text:#e8e6e0; --text2:#888780; --text3:#5f5e5a;
    --b:rgba(255,255,255,0.1); --b2:rgba(255,255,255,0.18); --b3:rgba(255,255,255,0.28);
  }
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; -webkit-font-smoothing:antialiased; }
body { font-family:var(--font); background:var(--bg); color:var(--text); line-height:1.65; }
a { color:var(--brand); text-decoration:none; }
a:hover { text-decoration:underline; }
code { font-family:var(--mono); font-size:12px; background:var(--bg3); padding:2px 7px; border-radius:5px; }

/* ── LAYOUT ──────────────────────────────────────────────────── */
.app-layout { display:flex; min-height:100vh; }
.main-content { flex:1; display:flex; flex-direction:column; min-width:0; }
.content-area { flex:1; padding:22px; }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width:var(--sw); min-width:var(--sw);
  background:var(--bg2); border-right:0.5px solid var(--b);
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh; overflow-y:auto;
}
.sidebar-brand {
  padding:18px 16px 14px; border-bottom:0.5px solid var(--b);
  display:flex; align-items:center; gap:10px;
}
.brand-mark {
  width:32px; height:32px; border-radius:8px;
  background:var(--brand); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:600; letter-spacing:-0.5px;
  flex-shrink:0;
}
.brand-name { font-size:15px; font-weight:600; color:var(--text); letter-spacing:-0.3px; }
.brand-sub  { font-size:10px; color:var(--text3); }

.sidebar-nav { flex:1; padding:8px; }
.nav-group { margin-bottom:20px; }
.nav-group-label { font-size:10px; color:var(--text3); text-transform:uppercase; letter-spacing:0.9px; padding:4px 10px 2px; }
.nav-item {
  display:flex; align-items:center; gap:9px;
  padding:8px 10px; border-radius:9px;
  font-size:13px; color:var(--text2);
  cursor:pointer; text-decoration:none;
  border:none; background:none; width:100%;
  font-family:var(--font); transition:all 0.1s;
}
.nav-item:hover { background:var(--bg3); color:var(--text); text-decoration:none; }
.nav-item.active { background:var(--bg3); color:var(--text); font-weight:500; }
.nav-icon { width:16px; text-align:center; font-size:13px; flex-shrink:0; }
.nav-badge {
  margin-left:auto; font-size:10px; font-weight:500;
  background:var(--brand); color:#fff;
  border-radius:10px; padding:1px 7px;
}
.sidebar-foot { padding:12px; border-top:0.5px solid var(--b); }

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  padding:13px 22px; border-bottom:0.5px solid var(--b);
  display:flex; align-items:center; justify-content:space-between;
  background:var(--bg2); position:sticky; top:0; z-index:20;
  gap:12px;
}
.topbar-title { font-size:16px; font-weight:500; }
.topbar-right { display:flex; align-items:center; gap:8px; }

/* ── AVATAR / USER CHIP ──────────────────────────────────────── */
.avatar {
  width:30px; height:30px; border-radius:50%;
  background:#dce9fc; color:#1140a6;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:500; flex-shrink:0;
}
.avatar.lg { width:40px; height:40px; font-size:14px; }
.user-chip { display:flex; align-items:center; gap:8px; padding:4px 8px; }
.user-name { font-size:12px; font-weight:500; }
.user-sub  { font-size:10px; color:var(--text3); }
.logout-btn {
  font-size:12px; color:var(--text3); cursor:pointer;
  border:none; background:none; padding:4px 6px;
}
.logout-btn:hover { color:#E24B4A; }

/* ── PLAN BADGE ──────────────────────────────────────────────── */
.plan-badge {
  font-size:10px; font-weight:600; padding:2px 8px;
  border-radius:10px; text-transform:uppercase; letter-spacing:0.4px;
}
.plan-free    { background:#f1efe8; color:#888780; border:0.5px solid var(--b2); }
.plan-pro     { background:#dce9fc; color:#1140a6; border:0.5px solid #a8c4f5; }
.plan-expired { background:#fcebeb; color:#A32D2D; border:0.5px solid #f09595; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn { display:inline-flex; align-items:center; gap:6px; border-radius:var(--r); font-family:var(--font); font-size:13px; font-weight:500; cursor:pointer; text-decoration:none; transition:all 0.12s; padding:8px 18px; border:none; white-space:nowrap; }
.btn:hover { text-decoration:none; }
.btn-primary { background:var(--brand); color:#fff; }
.btn-primary:hover { background:var(--brand-dk); }
.btn-secondary { background:transparent; color:var(--text); border:0.5px solid var(--b2); }
.btn-secondary:hover { background:var(--bg3); }
.btn-danger { background:transparent; color:#E24B4A; border:0.5px solid #E24B4A; }
.btn-danger:hover { background:#fcebeb; }
.btn-success { background:#3B6D11; color:#fff; border:none; }
.btn-success:hover { background:#27500A; }
.btn-sm { padding:5px 12px; font-size:12px; }
.btn-full { width:100%; justify-content:center; }
.btn-pro { background:linear-gradient(135deg,#1a56db,#7F77DD); color:#fff; }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { margin-bottom:14px; }
.form-group label { font-size:12px; color:var(--text2); margin-bottom:4px; display:block; }
.form-group .hint  { font-size:11px; color:var(--text3); margin-top:3px; }
input[type=text],input[type=email],input[type=password],input[type=number],input[type=tel],
select, textarea {
  width:100%; padding:9px 12px;
  border:0.5px solid var(--b2); border-radius:var(--r);
  font-family:var(--font); font-size:13px;
  background:var(--bg3); color:var(--text);
  outline:none; transition:border-color 0.12s;
}
input:focus,select:focus,textarea:focus { border-color:var(--brand); }
textarea { resize:vertical; min-height:84px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
.form-card { background:var(--bg2); border:0.5px solid var(--b); border-radius:var(--rl); padding:1.4rem; margin-bottom:14px; }
.form-card-title { font-size:13px; font-weight:500; margin-bottom:14px; padding-bottom:10px; border-bottom:0.5px solid var(--b); color:var(--text2); }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert { padding:11px 16px; border-radius:var(--r); font-size:13px; margin-bottom:14px; line-height:1.55; }
.alert a { font-weight:500; }
.alert-info    { background:#E6F1FB; color:#185FA5; }
.alert-success { background:#EAF3DE; color:#3B6D11; }
.alert-warning { background:#FAEEDA; color:#854F0B; }
.alert-danger  { background:#FCEBEB; color:#A32D2D; }
.limit-warn { border-left:3px solid #EF9F27; border-radius:0 var(--r) var(--r) 0; }

/* ── STATUS PILLS ────────────────────────────────────────────── */
.status {
  display:inline-flex; align-items:center; gap:5px;
  font-size:11px; font-weight:500; padding:3px 10px;
  border-radius:20px; white-space:nowrap;
}
.status-dot { width:6px; height:6px; border-radius:50%; }
.status-draft     { background:var(--bg3); color:var(--text2); } .status-draft .status-dot { background:var(--text3); }
.status-review    { background:#FAEEDA; color:#854F0B; } .status-review .status-dot { background:#EF9F27; }
.status-approved  { background:#EAF3DE; color:#3B6D11; } .status-approved .status-dot { background:#639922; }
.status-published { background:#E6F1FB; color:#185FA5; } .status-published .status-dot { background:#378ADD; }
.status-accepted  { background:#E1F5EE; color:#0F6E56; } .status-accepted .status-dot { background:#1D9E75; }
.status-rejected  { background:#FCEBEB; color:#A32D2D; } .status-rejected .status-dot { background:#E24B4A; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card-grid { display:grid; gap:10px; }
.card {
  background:var(--bg2); border:0.5px solid var(--b);
  border-radius:var(--rl); padding:1rem 1.25rem;
  cursor:pointer; transition:border-color 0.12s;
}
.card:hover { border-color:var(--b2); }
.card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:8px; }
.card-title { font-size:14px; font-weight:500; line-height:1.3; }
.card-sub { font-size:12px; color:var(--text2); margin-top:2px; }
.card-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11px; }
.chip { background:var(--bg3); border:0.5px solid var(--b); border-radius:6px; padding:2px 8px; font-size:11px; color:var(--text2); }
.chip-value { font-weight:500; font-size:13px; color:var(--text); margin-left:auto; }

/* ── STATS ───────────────────────────────────────────────────── */
.stats-row { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:22px; }
.stat-card { background:var(--bg3); border-radius:var(--r); padding:14px 16px; }
.stat-label { font-size:11px; color:var(--text2); margin-bottom:5px; }
.stat-value { font-size:26px; font-weight:500; line-height:1; }
.stat-sub   { font-size:11px; color:var(--text3); margin-top:4px; }

/* ── PROPOSAL VIEWER ─────────────────────────────────────────── */
.viewer { background:var(--bg2); border:0.5px solid var(--b); border-radius:var(--rl); overflow:hidden; }
.viewer-head { padding:22px 26px; border-bottom:0.5px solid var(--b); display:flex; gap:16px; align-items:flex-start; }
.viewer-co { font-size:12px; color:var(--text2); margin-bottom:6px; display:flex; align-items:center; gap:8px; }
.viewer-title { font-size:20px; font-weight:500; line-height:1.3; margin-bottom:4px; }
.viewer-client { font-size:13px; color:var(--text2); }
.viewer-meta { display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:12px; color:var(--text2); margin-top:8px; }
.viewer-amount { text-align:right; flex-shrink:0; }
.viewer-amount-big { font-size:22px; font-weight:500; font-family:var(--mono); }
.viewer-amount-gst { font-size:11px; color:var(--text3); }
.viewer-body { padding:22px 26px; }
.v-section { margin-bottom:22px; }
.v-section-title { font-size:10px; font-weight:500; text-transform:uppercase; letter-spacing:0.8px; color:var(--text3); margin-bottom:10px; padding-bottom:6px; border-bottom:0.5px solid var(--b); }
.v-content { font-size:13px; line-height:1.8; color:var(--text); }
.scope-row { display:flex; gap:8px; font-size:13px; margin-bottom:5px; }
.scope-bullet { color:var(--text3); flex-shrink:0; }
.tags-row { display:flex; flex-wrap:wrap; gap:6px; }
.co-badge { width:28px; height:28px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:600; color:#fff; flex-shrink:0; }

/* ── FEE TABLE ───────────────────────────────────────────────── */
.fee-table { width:100%; border-collapse:collapse; font-size:13px; }
.fee-table th { font-size:11px; color:var(--text2); padding:6px 12px; text-align:left; border-bottom:0.5px solid var(--b); }
.fee-table td { padding:9px 12px; border-bottom:0.5px solid var(--b); }
.fee-table .fee-gst td  { color:var(--text2); }
.fee-table .fee-total td { font-weight:500; border-top:0.5px solid var(--b2); }
.text-right { text-align:right; }
.mono { font-family:var(--mono); }

/* ── ACTION BAR ──────────────────────────────────────────────── */
.action-bar {
  padding:14px 22px; border-top:0.5px solid var(--b);
  display:flex; gap:8px; align-items:center; flex-wrap:wrap;
  background:var(--bg2);
}
.comment-input {
  flex:1; min-width:140px; padding:8px 12px;
  border:0.5px solid var(--b2); border-radius:var(--r);
  font-family:var(--font); font-size:13px;
  background:var(--bg3); color:var(--text); outline:none;
}
.comment-input:focus { border-color:var(--brand); }

/* ── COMMENTS ────────────────────────────────────────────────── */
.comment-item { display:flex; gap:10px; margin-bottom:14px; }
.comment-body { flex:1; }
.comment-meta { font-size:11px; color:var(--text3); margin-bottom:3px; display:flex; gap:6px; align-items:baseline; }
.comment-meta strong { color:var(--text2); font-size:12px; }
.comment-text { font-size:13px; color:var(--text2); line-height:1.6; }
.sys-badge { font-size:10px; background:var(--bg3); border:0.5px solid var(--b); border-radius:4px; padding:1px 5px; color:var(--text3); }

/* ── SERVICE TAGS ────────────────────────────────────────────── */
.service-grid { display:flex; flex-wrap:wrap; gap:6px; }
.service-tag {
  background:var(--bg3); border:0.5px solid var(--b2);
  border-radius:7px; padding:5px 11px;
  font-size:12px; cursor:pointer;
  transition:all 0.1s; user-select:none;
}
.service-tag.selected { background:var(--brand); color:#fff; border-color:var(--brand); }

/* ── SCOPE / FEE BUILDER ─────────────────────────────────────── */
.scope-item { display:flex; align-items:center; gap:8px; padding:6px 10px; background:var(--bg3); border-radius:8px; margin-bottom:6px; }
.fee-item { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.remove-btn { cursor:pointer; color:var(--text3); font-size:14px; border:none; background:none; padding:0 4px; flex-shrink:0; }
.remove-btn:hover { color:#E24B4A; }

/* ── LOGO PREVIEW ────────────────────────────────────────────── */
.logo-preview { width:72px; height:48px; border:0.5px dashed var(--b2); border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:10px; color:var(--text3); overflow:hidden; background:var(--bg3); flex-shrink:0; }
.logo-preview img { max-width:100%; max-height:100%; object-fit:contain; }
input[type=color] { width:36px; height:30px; border:0.5px solid var(--b2); border-radius:6px; padding:2px; cursor:pointer; background:var(--bg3); }

/* ── CLIENT LINK BOX ─────────────────────────────────────────── */
.link-box { font-size:12px; font-family:var(--mono); width:100%; margin:6px 0 4px; padding:7px 11px; border:0.5px solid var(--b); border-radius:6px; background:var(--bg3); color:var(--text); }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state { text-align:center; padding:52px 20px; color:var(--text2); }
.empty-icon { font-size:34px; margin-bottom:10px; opacity:0.35; }
.empty-state h3 { font-size:15px; font-weight:500; margin-bottom:6px; }
.empty-state p { font-size:13px; color:var(--text3); margin-bottom:16px; }

/* ── AUTH PAGES ──────────────────────────────────────────────── */
.auth-wrap { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:100vh; padding:20px; }
.auth-box { width:100%; max-width:440px; background:var(--bg2); border:0.5px solid var(--b); border-radius:var(--rx); padding:2rem; }
.auth-logo { display:flex; align-items:center; gap:10px; margin-bottom:24px; }
.auth-logo-mark { width:38px; height:38px; border-radius:10px; background:var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; }
.auth-logo-name { font-size:18px; font-weight:600; letter-spacing:-0.3px; }
.auth-logo-sub { font-size:12px; color:var(--text3); }
.auth-title { font-size:18px; font-weight:500; margin-bottom:4px; }
.auth-sub { font-size:13px; color:var(--text2); margin-bottom:22px; }
.auth-foot { margin-top:18px; font-size:12px; color:var(--text2); text-align:center; }

/* ── OTP INPUT ───────────────────────────────────────────────── */
.otp-group { display:flex; gap:8px; justify-content:center; margin:16px 0; }
.otp-digit { width:48px; height:56px; text-align:center; font-size:22px; font-weight:500; font-family:var(--mono); border:1.5px solid var(--b2); border-radius:var(--r); background:var(--bg3); color:var(--text); outline:none; }
.otp-digit:focus { border-color:var(--brand); }

/* ── LANDING PAGE ────────────────────────────────────────────── */
.lp-nav { display:flex; align-items:center; justify-content:space-between; padding:16px 40px; background:var(--bg2); border-bottom:0.5px solid var(--b); position:sticky; top:0; z-index:50; }
.lp-hero { text-align:center; padding:80px 20px 60px; max-width:680px; margin:0 auto; }
.lp-hero h1 { font-size:46px; font-weight:600; letter-spacing:-1px; line-height:1.15; margin-bottom:16px; }
.lp-hero p { font-size:18px; color:var(--text2); margin-bottom:32px; line-height:1.7; }
.lp-hero-btns { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
.lp-section { padding:60px 20px; max-width:960px; margin:0 auto; }
.lp-section-title { font-size:28px; font-weight:600; letter-spacing:-0.5px; margin-bottom:10px; }
.lp-section-sub { font-size:15px; color:var(--text2); margin-bottom:40px; }
.pricing-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; max-width:680px; margin:0 auto; }
.pricing-card { background:var(--bg2); border:0.5px solid var(--b); border-radius:var(--rx); padding:28px; }
.pricing-card.featured { border-color:var(--brand); border-width:1.5px; }
.pricing-plan { font-size:13px; font-weight:500; color:var(--text2); margin-bottom:8px; }
.pricing-amount { font-size:34px; font-weight:600; letter-spacing:-1px; margin-bottom:4px; }
.pricing-cycle { font-size:12px; color:var(--text3); margin-bottom:20px; }
.pricing-features { list-style:none; margin-bottom:24px; }
.pricing-features li { font-size:13px; padding:5px 0; color:var(--text2); display:flex; gap:8px; align-items:flex-start; }
.pricing-features li::before { content:'✓'; color:#3B6D11; font-weight:600; flex-shrink:0; }
.pricing-features li.no::before { content:'—'; color:var(--text3); }
.pricing-features li.no { color:var(--text3); }

/* ── UPGRADE PAGE ────────────────────────────────────────────── */
.upgrade-wrap { max-width:540px; margin:40px auto; }
.upgrade-card { background:var(--bg2); border:1.5px solid var(--brand); border-radius:var(--rx); padding:32px; text-align:center; }
.upgrade-price { font-size:42px; font-weight:600; letter-spacing:-1.5px; color:var(--brand); margin:16px 0 4px; }
.upgrade-features { text-align:left; margin:24px 0; }

/* ── TEMPLATES GRID ──────────────────────────────────────────── */
.templates-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.template-card { background:var(--bg2); border:0.5px solid var(--b); border-radius:var(--rl); padding:16px; cursor:pointer; transition:all 0.12s; }
.template-card:hover { border-color:var(--brand); }
.template-card.selected { border-color:var(--brand); border-width:1.5px; background:#f0f5ff; }
.template-card .tc-name { font-size:14px; font-weight:500; margin-bottom:4px; }
.template-card .tc-desc { font-size:12px; color:var(--text2); }

/* ── SECTION HEADING ─────────────────────────────────────────── */
.section-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.section-title { font-size:13px; font-weight:500; color:var(--text2); }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width:720px) {
  .app-layout { flex-direction:column; }
  .sidebar { width:100%; height:auto; position:static; }
  .stats-row { grid-template-columns:1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns:1fr; }
  .pricing-grid { grid-template-columns:1fr; }
  .viewer-head { flex-direction:column; }
  .lp-hero h1 { font-size:32px; }
  .lp-nav { padding:14px 20px; }
}
