/* QuoteDesk — ledger palette: cool slate ground, brass reserved for money only. */
:root {
  /* Navy and white. One family of blues, no competing accent colour. */
  --navy-900: #0B1B2E;   /* darkest — sidebar, login backdrop */
  --navy-800: #12263F;
  --navy-700: #1B3A5C;
  --navy-600: #24507E;   /* primary accent: buttons, active state, money */
  --navy-400: #4E7BAE;
  --navy-200: #A8C0DA;

  --ink: #0B1B2E;
  --ink-2: #12263F;
  --slate: #3D5470;
  --muted: #64768D;
  --canvas: #EEF2F7;     /* page ground, a white with a blue cast */
  --surface: #FFFFFF;
  --rule: #D3DDE9;
  --rule-soft: #E6ECF3;

  --accent: #24507E;
  --accent-soft: #E8F0F8;

  --good: #1B7A5A;
  --warn: #9A6B15;
  --bad: #A63A32;

  --radius: 4px;
  --shadow: 0 1px 2px rgba(11, 27, 46, .06), 0 6px 20px rgba(11, 27, 46, .06);
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }

/* Money and all figures are tabular mono so columns compare at a glance. */
.num, td.num, .money { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.money-strong { font-family: var(--mono); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy-900);
  color: #C3D3E5;
  padding: 18px 0 24px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { padding: 0 18px 16px; }
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: -.01em; }
.brand span { font-size: 11px; color: #7d94a8; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; flex: 1; overflow-y: auto; }
.nav a {
  color: #b9cadb; text-decoration: none; padding: 8px 10px; border-radius: var(--radius);
  font-size: 13.5px; display: flex; justify-content: space-between; align-items: center;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: var(--navy-600); color: #fff; font-weight: 500; }
.nav .sep { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #61798e; padding: 14px 10px 4px; }
.whoami { padding: 12px 18px 0; border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px; font-size: 12px; color: #8fa5b8; }
.whoami b { color: #fff; display: block; font-size: 13px; }

.main { padding: 22px 26px 60px; min-width: 0; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 21px; margin: 0; letter-spacing: -.02em; font-weight: 600; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
h2 { font-size: 14px; margin: 0 0 10px; letter-spacing: -.01em; }
.eyebrow { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--rule-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.split { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }

.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; padding: 9px 10px; background: #f5f8fa;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
tbody tr:hover { background: #fafcfd; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sub { font-size: 11.5px; color: var(--muted); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

/* ---------- Signature: the margin ribbon ---------- */
.ribbon { height: 3px; background: var(--rule-soft); border-radius: 2px; overflow: hidden; min-width: 46px; }
.ribbon i { display: block; height: 100%; background: var(--good); transition: width .18s ease, background .18s ease; }
.ribbon.thin i { background: var(--warn); }
.ribbon.ok i { background: #2f7d6b; }
.ribbon.loss i { background: var(--bad); }
.margin-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.margin-val { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.margin-val.loss { color: var(--bad); font-weight: 600; }
.margin-val.thin { color: var(--warn); }
.margin-val.good { color: var(--good); }

.meter { text-align: center; padding: 4px 0 10px; }
.meter .big { font-family: var(--mono); font-size: 34px; font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.meter .big.loss { color: var(--bad); }
.meter .big.thin { color: var(--warn); }
.meter .big.ok, .meter .big.good { color: var(--good); }
.meter .lbl { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

/* ---------- Controls ---------- */
label { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: #fff; font-family: var(--sans); font-size: 13.5px; color: var(--ink);
}
input[type=number], input.money-in { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; text-transform: none; letter-spacing: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: #fff; color: var(--ink); font-family: var(--sans);
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--slate); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-brass { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { color: var(--bad); border-color: #e5c6c2; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { margin: 0; }

/* ---------- Status & flash ---------- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--rule); color: var(--muted); background: #f5f8fa; white-space: nowrap;
}
.pill.draft { background: #f2f5f8; }
.pill.sent { background: #eaf1fa; color: #24558c; border-color: #cfdff2; }
.pill.accepted { background: #e6f3ef; color: var(--good); border-color: #c2e2d8; }
.pill.rejected, .pill.cancelled { background: #fbeceb; color: var(--bad); border-color: #eecfcc; }
.pill.expired { background: #fbf3e3; color: var(--warn); border-color: #ecdcbb; }
.pill.superseded { background: #eef1f4; color: var(--muted); border-color: var(--rule); text-decoration: line-through; }
.pill.brass { background: var(--accent-soft); color: var(--accent); border-color: #C6D8EA; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.flash.ok { background: #e9f4f1; border-color: #bfe0d7; color: #0a5c50; }
.flash.error { background: #fbeceb; border-color: #eecfcc; color: #8f2b21; }
.banner { background: var(--accent-soft); border: 1px solid #C6D8EA; color: var(--navy-700); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }

/* ---------- Login ---------- */





/* ---------- Quote editor specifics ---------- */
.line-table td { padding: 6px 8px; }
.line-table input { padding: 5px 7px; font-size: 13px; }
.line-name { font-weight: 500; }
.cap-note { font-size: 11px; color: var(--muted); text-align: right; margin-top: 3px; }
input.over-cap { border-color: var(--bad); background: #fdf4f3; }
.totals-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.totals-row.grand { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 9px; font-size: 16px; font-weight: 600; }
.rail { position: sticky; top: 18px; }
.searchbox { position: relative; }
.results {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 3px; background: #fff;
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 300px; overflow-y: auto;
}
.results button {
  display: block; width: 100%; text-align: left; padding: 8px 11px; border: 0; background: none;
  border-bottom: 1px solid var(--rule-soft); cursor: pointer; font-family: var(--sans); font-size: 13px;
}
.results button:hover, .results button.active { background: var(--accent-soft); }
.results .r-price { float: right; font-family: var(--mono); font-size: 12px; color: var(--accent); }
.results .r-sub { font-size: 11px; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.timeline li { padding: 7px 0; border-bottom: 1px solid var(--rule-soft); color: var(--muted); }
.timeline b { color: var(--ink); font-weight: 500; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .split, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .scroll-x { overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .sidebar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------- Arabic ---------- */
/* Browsers shape and order Arabic correctly on their own; the PDF is where the
   work happens. Here we only need a face with good Arabic coverage. */
.ar, [dir="rtl"] {
  font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, 'Traditional Arabic', serif;
  direction: rtl;
  text-align: right;
}
td .ar, .line-name + .ar { text-align: right; display: block; }
input.ar, textarea.ar { text-align: right; }
label .ar { font-weight: 500; }

/* Pending-approval count in the menu */
.badge {
  background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px;
  font-size: 11px; font-weight: 600; min-width: 18px; text-align: center;
  font-family: var(--mono);
}
.nav a.on .badge { background: rgba(255,255,255,.28); }

/* Logo slots. Drop artwork at public/img/logo.png and it appears everywhere. */
.brand-logo {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(168,192,218,.22);
  border-radius: var(--radius);
  padding: 8px; margin-bottom: 10px;
  display: grid; place-items: center; min-height: 44px;
}
.brand-logo img { max-width: 100%; max-height: 40px; filter: brightness(0) invert(1); opacity: .9; }

/* ---------- Sign in ----------
   Dark, centred, and quiet. The expense is in the restraint: one accent, a
   hairline border, real depth from layered shadow, and motion slow enough that
   you notice it only if you look. */

.auth {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: #081524;
  overflow: hidden;
}

.auth-field {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}

.auth-panel {
  position: relative;
  width: 100%;
  max-width: 394px;
}

/* --- Brand above the card --- */
.auth-brand { text-align: center; margin-bottom: 26px; }

.auth-mark {
  width: 74px; height: 74px; margin: 0 auto 18px;
  border-radius: 14px;
  display: grid; place-items: center; padding: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
  border: 1px solid rgba(168,192,218,.20);
  box-shadow: 0 18px 34px -16px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.14);
}
.auth-mark img { max-width: 100%; max-height: 100%; filter: brightness(0) invert(1); opacity: .94; }

.auth-brand h1 {
  font-size: 17px; font-weight: 600; color: #F2F6FA;
  letter-spacing: -.01em; margin: 0; line-height: 1.35;
}
.auth-ar { font-size: 15px; color: #92AAC5; margin-top: 3px; text-align: center; }

/* --- The card --- */
.auth-card {
  position: relative;
  border-radius: 12px;
  padding: 30px 28px 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  border: 1px solid rgba(168,192,218,.16);
  box-shadow:
    0 40px 80px -28px rgba(0,0,0,.85),
    0 2px 8px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.09);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  overflow: hidden;
}

/* A light travelling along the top edge, once in a while */
.auth-sheen {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    rgba(168,192,218,0) 0%,
    rgba(168,192,218,0) 25%,
    rgba(214,231,247,.85) 50%,
    rgba(168,192,218,0) 75%,
    rgba(168,192,218,0) 100%);
  background-size: 220% 100%;
  animation: edge-light 7.5s ease-in-out infinite;
}

.auth-head { margin-bottom: 22px; }
.auth-head h2 { font-size: 20px; font-weight: 600; color: #fff; margin: 0; letter-spacing: -.01em; }
.auth-head p { margin: 4px 0 0; font-size: 12.5px; color: #8299B3; }

.auth-field-row { margin-bottom: 15px; }
.auth-field-row label {
  display: block; font-size: 10px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: #8299B3; margin-bottom: 7px;
}

.auth-card input[type=email],
.auth-card input[type=password] {
  width: 100%; padding: 11px 13px;
  background: rgba(7, 17, 29, .62);
  border: 1px solid rgba(168,192,218,.18);
  border-radius: 7px;
  color: #F2F6FA; font-family: var(--sans); font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-card input::placeholder { color: #4E637C; }
.auth-card input:hover { border-color: rgba(168,192,218,.30); }
.auth-card input:focus {
  outline: none;
  border-color: #4E7BAE;
  background: rgba(7, 17, 29, .82);
  box-shadow: 0 0 0 3px rgba(78,123,174,.20);
}
.auth-card input:-webkit-autofill {
  -webkit-text-fill-color: #F2F6FA;
  -webkit-box-shadow: 0 0 0 1000px #0C1B2C inset;
}

.auth-submit {
  width: 100%; margin-top: 8px; padding: 12px;
  border: 1px solid rgba(168,192,218,.26);
  border-radius: 7px; cursor: pointer;
  background: linear-gradient(180deg, #2A5B8E 0%, #1E4370 100%);
  color: #fff; font-family: var(--sans); font-size: 14px; font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 10px 22px -10px rgba(20,55,95,.9), inset 0 1px 0 rgba(255,255,255,.16);
  transition: transform .12s ease, box-shadow .18s ease, filter .18s ease;
}
.auth-submit:hover { filter: brightness(1.10); box-shadow: 0 14px 26px -10px rgba(20,55,95,1), inset 0 1px 0 rgba(255,255,255,.22); }
.auth-submit:active { transform: translateY(1px); box-shadow: 0 6px 14px -8px rgba(20,55,95,.9), inset 0 1px 0 rgba(255,255,255,.12); }
.auth-submit:focus-visible { outline: 2px solid #7FA8D4; outline-offset: 2px; }

.auth-help {
  margin: 18px 0 0; padding-top: 16px;
  border-top: 1px solid rgba(168,192,218,.12);
  font-size: 11.5px; color: #73899F; line-height: 1.6;
}

.auth-alert, .auth-note {
  padding: 10px 13px; border-radius: 7px; font-size: 12.5px;
  margin-bottom: 16px; border: 1px solid;
}
.auth-alert { background: rgba(166,58,50,.16); border-color: rgba(214,120,112,.42); color: #F3C7C3; }
.auth-note  { background: rgba(27,122,90,.16); border-color: rgba(96,183,152,.40); color: #BFE6D6; }

.auth-foot {
  margin: 22px 0 0; text-align: center;
  font-size: 11px; color: #4E637C; letter-spacing: .02em;
}

/* --- Motion: slow enough to be felt rather than watched --- */
@keyframes pool-a { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(90px, 70px) scale(1.07); } }
@keyframes pool-b { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-80px, -60px) scale(1.05); } }
@keyframes mesh-breathe { 0%, 100% { opacity: .055; } 50% { opacity: .10; } }
@keyframes edge-light { 0% { background-position: 120% 0; } 55%, 100% { background-position: -120% 0; } }
@keyframes card-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes brand-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.pool-a { animation: pool-a 30s ease-in-out infinite; transform-origin: 300px 260px; }
.pool-b { animation: pool-b 36s ease-in-out infinite; transform-origin: 920px 690px; }
.mesh   { animation: mesh-breathe 16s ease-in-out infinite; }
.auth-brand { animation: brand-rise .7s cubic-bezier(.22,.9,.3,1) both; }
.auth-card  { animation: card-rise .75s cubic-bezier(.22,.9,.3,1) .1s both; }
.auth-foot  { animation: brand-rise .7s ease .3s both; }

@media (max-width: 480px) {
  .auth { padding: 28px 16px; }
  .auth-card { padding: 24px 20px 22px; }
  .auth-mark { width: 62px; height: 62px; margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .pool-a, .pool-b, .mesh, .auth-sheen, .auth-brand, .auth-card, .auth-foot { animation: none; }
  .auth-card, .auth-brand, .auth-foot { opacity: 1; transform: none; }
}
