/* ==========================================================================
   Jesse Paul & Co. — application shell
   Palette lifted from the firm's Word requisitions:
   navy #0D1F2D · gold #C9A84C · light gold #E8CC80 · cream #FFFDF5
   ========================================================================== */

:root {
  --navy:        #0D1F2D;
  --navy-700:    #16324a;
  --navy-500:    #24486a;
  --gold:        #C9A84C;
  --gold-light:  #E8CC80;
  --gold-dim:    #A98A33;
  --cream:       #FFFDF5;
  --cream-2:     #FAF8F2;
  --paper:       #ffffff;
  --ink:         #16202b;
  --ink-soft:    #4a5561;
  --muted:       #7A7260;
  --line:        #e6e1d6;
  --line-soft:   #f0ece2;
  --danger:      #8B2020;
  --success:     #2E7D6F;
  --warn:        #B8791F;
  --info:        #1E4E8C;

  --radius:      14px;
  --radius-sm:   9px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 2px rgba(13,31,45,.06), 0 1px 3px rgba(13,31,45,.05);
  --shadow:      0 4px 14px rgba(13,31,45,.07), 0 1px 3px rgba(13,31,45,.05);
  --shadow-lg:   0 18px 45px rgba(13,31,45,.14), 0 4px 12px rgba(13,31,45,.07);

  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
           "Helvetica Neue", Arial, sans-serif;

  --sidebar-w: 258px;
  --header-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream-2);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-500); text-decoration: none; }
a:hover { color: var(--gold-dim); }

/* Inline icons default to text size; later rules below re-size them in context.
   Without this an unwrapped icon stretches to fill its flex parent. */
.main svg { width: 18px; height: 18px; flex: 0 0 auto; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 600; }
h1 { font-family: var(--serif); font-size: 2rem; font-weight: 600; letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
h3 { font-size: 1.05rem; }

/* ------------------------------------------------------------------ layout */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(178deg, var(--navy) 0%, #0a1822 100%);
  color: #cfd8e0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.35rem 1.25rem 1.15rem;
  border-bottom: 1px solid rgba(201,168,76,.2);
}
.brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 2px; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-name {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
  line-height: 1.15;
  white-space: nowrap;
}
.brand-sub {
  font-size: .62rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 2px;
}

.nav { padding: .9rem .7rem; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: .62rem; letter-spacing: .16em; text-transform: uppercase;
  color: #6b7b88; padding: .9rem .6rem .4rem;
}
.nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .65rem; border-radius: var(--radius-sm);
  color: #c3ced8; font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(201,168,76,.16); color: var(--gold-light); }
.nav a.active svg { color: var(--gold); }
.nav svg { width: 17px; height: 17px; flex: 0 0 17px; color: #7d8b98; }
.nav a:hover svg { color: #cfd8e0; }

.nav-cta { padding: .5rem .7rem 1rem; }
.nav-foot {
  padding: .9rem 1.25rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: .72rem; color: #6b7b88; line-height: 1.5;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 {
  font-size: 1.18rem; margin: 0; font-family: var(--sans); font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }

.content { padding: 1.6rem; max-width: 1360px; width: 100%; }

/* ---------------------------------------------------------------- elements */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.25rem; }
.card-head {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; font-family: var(--sans); font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-head > svg { color: var(--gold-dim); }

.grid { display: grid; gap: 1rem; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stack { display: grid; gap: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: .875rem; font-weight: 550; cursor: pointer;
  transition: all .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #cfc7b6; background: var(--cream); color: var(--ink); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--navy); border-color: var(--navy); color: #fff;
}
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border-color: var(--gold-dim); color: #3c2f0c;
}
.btn-gold:hover { filter: brightness(1.04); color: #3c2f0c; }
.btn-danger { color: var(--danger); border-color: #e7cccc; background: #fff; }
.btn-danger:hover { background: #fdf3f3; border-color: #d9aeae; color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(13,31,45,.05); border-color: transparent; }
.btn-sm { padding: .34rem .68rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.35rem; font-size: .95rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .58rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-draft     { color: var(--muted);   background: #f7f5f0; }
.pill-issued    { color: var(--gold-dim);background: #fdf8e9; }
.pill-paid      { color: var(--success); background: #eef7f5; }
.pill-partial   { color: var(--warn);    background: #fdf5e9; }
.pill-overdue   { color: var(--danger);  background: #fbf0f0; }
.pill-cancelled { color: #5A5A5A;        background: #f4f4f4; }
.pill-type { color: var(--navy-500); background: #eef2f7; border-color: #dbe3ec; }

/* stat tiles */
.stat {
  position: relative; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.stat::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--gold);
}
.stat.is-navy::before   { background: var(--navy); }
.stat.is-success::before{ background: var(--success); }
.stat.is-danger::before { background: var(--danger); }
.stat-label {
  font-size: .68rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.stat-value {
  font-family: var(--serif); font-size: 1.85rem; font-weight: 600;
  color: var(--navy); line-height: 1.15; margin-top: .3rem;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.stat-value .cur { font-size: .95rem; color: var(--muted); font-family: var(--sans); font-weight: 600; }
.stat-foot { font-size: .78rem; color: var(--ink-soft); margin-top: .3rem; }

/* bar strip */
.bars { display: flex; align-items: flex-end; gap: .55rem; height: 92px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: .4rem; }
.bars .bar i {
  display: block; width: 100%; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  min-height: 6px;
}
.bars .bar span { font-size: .68rem; color: var(--muted); text-align: center; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th {
  text-align: left; font-size: .68rem; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: .7rem 1rem;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--cream-2);
}
table.data td { padding: .8rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:hover { background: var(--cream); }
table.data tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* Row actions stay on one line and take only the width they need. */
table.data td.cell-actions { width: 1%; white-space: nowrap; }
table.data td.cell-actions .row { flex-wrap: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.strong { font-weight: 650; }
.soa-link { font-weight: 650; color: var(--navy); letter-spacing: .01em; white-space: nowrap; }
.soa-link:hover { color: var(--gold-dim); }
.sub { font-size: .78rem; color: var(--muted); }

/* forms */
.field { display: block; margin-bottom: .95rem; }
.field > label, .lbl {
  display: block; font-size: .74rem; font-weight: 650; color: var(--ink-soft);
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: .32rem;
}
input[type=text], input[type=email], input[type=date], input[type=number],
input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: .58rem .7rem; font: inherit; font-size: .9rem;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,.16);
}
select { appearance: none; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237A7260' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
.hint { font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.check { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; cursor: pointer; padding: .3rem 0; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--gold-dim); flex: 0 0 auto; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
legend {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--navy);
  padding: 0 0 .2rem; margin-bottom: .9rem; width: 100%;
  border-bottom: 1px solid var(--line);
}
legend .n {
  display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: var(--navy); color: var(--gold-light);
  font-family: var(--sans); font-size: .7rem; font-weight: 700; margin-right: .5rem;
  vertical-align: 2px;
}

.search-bar { position: relative; flex: 1; min-width: 180px; max-width: 380px; }
.search-bar svg { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search-bar input { padding-left: 2.05rem; }

/* type chooser cards */
.type-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.type-card {
  display: block; position: relative; overflow: hidden;
  padding: 1.5rem 1.35rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.type-card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent, var(--gold));
}
.type-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--cream); border: 1px solid var(--line); margin-bottom: .85rem;
}
.type-icon svg { width: 22px; height: 22px; color: var(--accent, var(--gold-dim)); }
.type-card h3 { font-family: var(--serif); font-size: 1.3rem; color: var(--navy); margin-bottom: .25rem; }
.type-card p { margin: 0; font-size: .85rem; color: var(--ink-soft); line-height: 1.5; }
.type-card .go { margin-top: 1rem; font-size: .8rem; font-weight: 650; color: var(--gold-dim); }

/* particulars editor */
.item-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .9rem; margin-bottom: .8rem; background: var(--cream-2);
}
.item-row.is-discount { background: #fdf6f6; border-color: #ecd9d9; }
.item-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.item-head .idx {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  background: var(--navy); color: var(--gold-light);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
}
.item-row.is-discount .idx { background: var(--danger); color: #fff; }
.item-money { display: grid; grid-template-columns: 1fr 1fr auto; gap: .6rem; align-items: end; margin-top: .6rem; }

.totals-box {
  background: var(--navy); color: #fff; border-radius: var(--radius); padding: 1.1rem 1.25rem;
}
.totals-box .line { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; font-size: .88rem; color: #b9c6d2; }
.totals-box .line.total {
  border-top: 1px solid rgba(201,168,76,.35); margin-top: .5rem; padding-top: .7rem;
  color: #fff; font-size: 1.15rem; font-family: var(--serif); font-weight: 600;
}
.totals-box .line.total b { color: var(--gold-light); font-weight: 600; }

/* flashes */
.flashes { margin-bottom: 1rem; display: grid; gap: .5rem; }
.flash {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1rem; border-radius: var(--radius-sm); font-size: .88rem;
  border: 1px solid; background: #fff;
}
.flash-success { color: var(--success); border-color: #cfe5e0; background: #f2f9f7; }
.flash-error   { color: var(--danger);  border-color: #e9cfcf; background: #fdf4f4; }
.flash-info    { color: var(--info);    border-color: #d3dff0; background: #f3f7fd; }

/* misc */
.page-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem; }
.page-head .spacer { flex: 1; }
.page-head p { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--line); margin-bottom: .75rem; }
.empty h3 { color: var(--ink); font-family: var(--serif); font-size: 1.3rem; }
.divider { height: 1px; background: var(--line-soft); margin: 1.1rem 0; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.chip {
  padding: .34rem .8rem; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: .8rem; font-weight: 550; color: var(--ink-soft);
}
.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.scrim { display: none; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(13,31,45,.45); backdrop-filter: blur(2px);
  }
  .menu-btn { display: inline-flex; }
  .content { padding: 1.1rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  h1 { font-size: 1.6rem; }
  .grid-4 { grid-template-columns: 1fr; }
  .content { padding: .9rem; }
  .topbar { padding: 0 .9rem; }
  .topbar h1 { font-size: 1.02rem; }
  .stat-value { font-size: 1.6rem; }
  .item-money { grid-template-columns: 1fr; }
  .page-head { gap: .6rem; }
  .page-head .row { width: 100%; }
  .page-head .btn { flex: 1; }

  /* tables collapse into stacked cards */
  table.data.stacky { width: 100%; }
  table.data.stacky thead { display: none; }
  table.data.stacky tbody tr {
    display: block; border: 1px solid var(--line); border-radius: var(--radius-sm);
    margin-bottom: .7rem; padding: .3rem .1rem; background: #fff;
  }
  table.data.stacky td {
    display: flex; justify-content: space-between; gap: 1rem; align-items: center;
    border: 0; padding: .42rem .85rem; text-align: right;
  }
  table.data.stacky td::before {
    content: attr(data-label); font-size: .68rem; letter-spacing: .1em;
    text-transform: uppercase; color: var(--muted); font-weight: 700;
    text-align: left; flex: 0 0 auto;
  }
  table.data.stacky td.cell-main { display: block; text-align: left; padding-top: .7rem; }
  table.data.stacky td.cell-main::before { display: none; }
  table.data.stacky td.cell-actions { justify-content: flex-end; padding-bottom: .7rem; }
}

@media print {
  .sidebar, .topbar, .no-print, .flashes { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* ------------------------------------------------------- modal dialog */

.dlg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  width: min(620px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.dlg::backdrop { background: rgba(13,31,45,.5); backdrop-filter: blur(3px); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }

.dlg-head {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line-soft);
  background: var(--cream-2);
}
.dlg-head h2 { font-size: 1.4rem; margin: 0 0 .1rem; color: var(--navy); }
.dlg-head .btn { margin-left: auto; font-size: 1rem; line-height: 1; }

.dlg-body { padding: 1.25rem; overflow-y: auto; flex: 1; }

.dlg-foot {
  display: flex; gap: .6rem; justify-content: flex-end;
  padding: .9rem 1.25rem; border-top: 1px solid var(--line-soft);
  background: var(--cream-2);
}

.dlg-error {
  margin: .9rem 0 0; padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: #fdf4f4; border: 1px solid #e9cfcf; color: var(--danger);
  font-size: .85rem;
}

@media (max-width: 640px) {
  .dlg { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; border: 0; }
  .dlg form { max-height: 100dvh; }
  .dlg-foot { position: sticky; bottom: 0; }
  .dlg-foot .btn { flex: 1; }
}

@media (max-width: 560px) {
  .topbar { gap: .5rem; padding: 0 .75rem; }
  .topbar .btn { font-size: 0; gap: 0; padding: .42rem .55rem; }
  .topbar .btn svg { width: 17px; height: 17px; }
}

/* ------------------------------------------- destructive confirmation */

.btn-danger-solid {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.btn-danger-solid:hover:not(:disabled) {
  background: #741a1a; border-color: #741a1a; color: #fff;
}
.btn-danger-solid:disabled { background: #d9b7b7; border-color: #d9b7b7; color: #fff; }

.cf-warn {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  background: #fdf4f4; border: 1px solid #e9cfcf; color: #6d2222;
  font-size: .88rem; line-height: 1.55;
}
.cf-warn b { color: var(--danger); }
.cf-warn ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.cf-warn li { margin: .15rem 0; }
.cf-lit {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--cream); border: 1px solid var(--line);
  padding: .05rem .35rem; border-radius: 4px; color: var(--danger);
  text-transform: none; letter-spacing: 0;
}
#cf-word { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
#cf-word.is-match { border-color: var(--success); box-shadow: 0 0 0 3px rgba(46,125,111,.14); }

/* ==========================================================================
   Everything-search (command palette)
   ========================================================================== */

.omni-trigger {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .42rem .7rem .42rem .6rem;
  min-width: 260px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--cream-2); color: var(--muted);
  font: inherit; font-size: .85rem; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.omni-trigger:hover {
  border-color: var(--gold); background: #fff;
  box-shadow: 0 1px 3px rgba(13,31,45,.06);
}
.omni-trigger svg { width: 15px; height: 15px; color: var(--gold-dim); }
.omni-trigger-text { flex: 1; text-align: left; }
.omni-kbd {
  font-family: var(--sans); font-size: .66rem; font-weight: 650; letter-spacing: .03em;
  color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: .1rem .34rem; white-space: nowrap;
}

.omni { position: fixed; inset: 0; z-index: 200; }
.omni[hidden] { display: none; }
.omni-scrim {
  position: absolute; inset: 0;
  background: rgba(13,31,45,.42); backdrop-filter: blur(4px);
  animation: omni-fade .18s ease;
}
@keyframes omni-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes omni-rise {
  from { opacity: 0; transform: translateY(-10px) scale(.985) }
  to   { opacity: 1; transform: none }
}

.omni-panel {
  position: relative;
  width: min(680px, calc(100vw - 2rem));
  margin: min(11vh, 90px) auto 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(13,31,45,.3), 0 6px 18px rgba(13,31,45,.14);
  overflow: hidden;
  animation: omni-rise .2s cubic-bezier(.2,.9,.3,1);
  display: flex; flex-direction: column;
  max-height: min(74vh, 640px);
}
/* the gold hairline that ties it to the document furniture */
.omni-panel::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}

.omni-input {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.05rem 1.15rem; border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.omni-input > svg { width: 19px; height: 19px; color: var(--gold-dim); flex: 0 0 auto; }
.omni-input input {
  flex: 1; min-width: 0; border: 0; padding: 0; background: none;
  font-size: 1.06rem; color: var(--ink); font-family: var(--sans);
}
.omni-input input:focus { outline: none; box-shadow: none; }
.omni-input input::placeholder { color: #a9a294; }
.omni-esc {
  font: inherit; font-size: .68rem; font-weight: 650; letter-spacing: .04em;
  color: var(--muted); background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 6px; padding: .18rem .45rem; cursor: pointer;
}
.omni-esc:hover { border-color: var(--gold); color: var(--ink); }

.omni-spin {
  width: 15px; height: 15px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--gold-dim);
  animation: omni-spin .6s linear infinite;
}
@keyframes omni-spin { to { transform: rotate(360deg) } }

.omni-results { overflow-y: auto; padding: .45rem 0 .3rem; flex: 1 1 auto; }
.omni-group-label {
  font-size: .62rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: .7rem 1.15rem .3rem;
}
.omni-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem 1.15rem; cursor: pointer; text-decoration: none;
  color: var(--ink); border-left: 2px solid transparent;
}
.omni-item:hover { background: var(--cream); color: var(--ink); }
.omni-item.is-active {
  background: linear-gradient(90deg, rgba(201,168,76,.14), rgba(201,168,76,.04));
  border-left-color: var(--gold);
}
.omni-ico {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--cream-2); border: 1px solid var(--line); color: var(--gold-dim);
}
.omni-item.is-active .omni-ico { background: #fff; border-color: var(--gold); }
.omni-ico svg { width: 16px; height: 16px; }
.omni-text { flex: 1; min-width: 0; display: block; }
.omni-title {
  display: block;
  font-weight: 650; font-size: .93rem; color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omni-sub {
  display: block;
  font-size: .78rem; color: var(--muted); margin-top: .05rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omni-right { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.omni-amt {
  font-size: .84rem; font-weight: 650; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.omni-item mark {
  background: rgba(201,168,76,.28); color: inherit;
  border-radius: 3px; padding: 0 .1em; font-weight: 700;
}

.omni-empty { padding: 2.6rem 1.25rem; text-align: center; color: var(--muted); }
.omni-empty svg { width: 34px; height: 34px; color: var(--line); margin-bottom: .5rem; }
.omni-empty b { color: var(--ink); }

.omni-foot {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .55rem 1.15rem; border-top: 1px solid var(--line-soft);
  background: var(--cream-2); font-size: .7rem; color: var(--muted);
  flex: 0 0 auto;
}
.omni-foot .spacer { flex: 1; }
.omni-foot kbd {
  font-family: var(--sans); font-size: .66rem; font-weight: 650;
  background: #fff; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: .04rem .3rem; margin-right: .18rem; color: var(--ink-soft);
}

@media (max-width: 900px) {
  .omni-trigger { min-width: 0; padding: .42rem .55rem; }
  .omni-trigger-text, .omni-kbd { display: none; }
}
@media (max-width: 640px) {
  .omni-panel { margin-top: 0; width: 100vw; border-radius: 0; border: 0;
                max-height: 100dvh; height: 100dvh; }
  .omni-foot span:not(.spacer):not(#omni-count) { display: none; }
  .omni-item { padding: .6rem .9rem; }
  .omni-amt { display: none; }
}

/* waiting account requests, on the sidebar Users link */
.nav-badge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--gold); color: #3c2f0c;
  font-size: .68rem; font-weight: 700; display: grid; place-items: center;
}

/* ==========================================================================
   Colour system for the application chrome.

   The statement itself stays navy-and-gold exactly as the firm's Word
   original — none of this touches invoice.css. These are jewel tones for the
   surrounding interface, so each kind of matter and each state reads at a
   glance without shouting.
   ========================================================================== */

:root {
  --c-teal:    #2E7D6F;   --c-teal-tint:    #EAF4F1;   --c-teal-line:    #C6E2DA;
  --c-crimson: #8B2020;   --c-crimson-tint: #FBEFEF;   --c-crimson-line: #EBCFCF;
  --c-indigo:  #1E4E8C;   --c-indigo-tint:  #ECF1F9;   --c-indigo-line:  #CFDCEF;
  --c-amber:   #B8791F;   --c-amber-tint:   #FDF4E7;   --c-amber-line:   #EFDCBC;
  --c-plum:    #6B4E7D;   --c-plum-tint:    #F4F0F7;   --c-plum-line:    #DED2E6;
  --c-gold-tint: #FDF8E9;
}

/* ------------------------------------------------------------- stat tiles */

.stat {
  --tone: var(--gold);
  --tone-tint: var(--c-gold-tint);
  background: linear-gradient(160deg, var(--tone-tint) 0%, #fff 58%);
}
.stat::before { background: var(--tone); width: 4px; }
.stat.is-navy    { --tone: var(--navy);      --tone-tint: #EEF2F6; }
.stat.is-success { --tone: var(--c-teal);    --tone-tint: var(--c-teal-tint); }
.stat.is-danger  { --tone: var(--c-crimson); --tone-tint: var(--c-crimson-tint); }
.stat.is-info    { --tone: var(--c-indigo);  --tone-tint: var(--c-indigo-tint); }
.stat.is-plum    { --tone: var(--c-plum);    --tone-tint: var(--c-plum-tint); }

.stat-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .1rem; }
.stat-ico {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: #fff; border: 1px solid var(--tone);
  color: var(--tone);
}
.stat-ico svg { width: 15px; height: 15px; }
.stat-top .stat-label { margin: 0; }
.stat-value { color: var(--navy); }
.stat.is-success .stat-value,
.stat.is-danger .stat-value,
.stat.is-info .stat-value,
.stat.is-plum .stat-value { color: var(--tone); }

/* ------------------------------------------------------------- type pills */

.pill-consultation { color: var(--c-teal);    background: var(--c-teal-tint);    border-color: var(--c-teal-line); }
.pill-papl         { color: var(--c-crimson); background: var(--c-crimson-tint); border-color: var(--c-crimson-line); }
.pill-litigation   { color: var(--c-indigo);  background: var(--c-indigo-tint);  border-color: var(--c-indigo-line); }

/* ------------------------------------------------------------- card heads */

.card-head {
  background: linear-gradient(180deg, var(--cream-2), #fff);
  border-bottom: 1px solid var(--line);
}
.card-head > svg {
  width: 30px; height: 30px; padding: 6px; border-radius: 8px;
  background: var(--c-gold-tint); border: 1px solid var(--line);
  color: var(--gold-dim); box-sizing: border-box;
}

/* --------------------------------------------------------- page furniture */

.page-head h1 { position: relative; padding-bottom: .45rem; }
.page-head h1::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 42px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

/* ------------------------------------------------------------ nav accents */

.nav a[href$="type=consultation"] svg { color: #6fbfae; }
.nav a[href$="type=papl"] svg         { color: #dd9a9a; }
.nav a[href$="type=litigation"] svg   { color: #8fb2dd; }

/* ---------------------------------------------------------------- tables */

table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--c-gold-tint); }
.soa-link { position: relative; }

/* --------------------------------------------------------- type chooser */

.type-card { background: linear-gradient(165deg, #fff 55%, var(--tint, var(--c-gold-tint))); }
.type-card::after { height: 4px; }
.type-icon { background: var(--tint, var(--cream)); border-color: var(--accent); }
.type-icon svg { color: var(--accent); }
.type-card h3 { color: var(--accent); }
.type-card .go { color: var(--accent); }

/* ------------------------------------------------------- empty states */

.empty svg {
  width: 54px; height: 54px; padding: 12px; border-radius: 16px;
  background: var(--c-gold-tint); border: 1px solid var(--line);
  color: var(--gold-dim); box-sizing: border-box;
}

/* ------------------------------------------------------------ bar strip */

.bars .bar i {
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dim));
}
.bars .bar:last-child i {
  background: linear-gradient(180deg, #7fb3e0, var(--c-indigo));
}

/* ------------------------------------------------- dashboard type buttons */

.tbtn {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff;
  font-size: .88rem; font-weight: 600; color: var(--ink);
  text-decoration: none; transition: all .15s;
}
.tbtn:hover {
  border-color: var(--accent); background: var(--tint);
  color: var(--accent); transform: translateX(2px);
}
.tbtn .ico {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--tint); color: var(--accent); border: 1px solid var(--line);
}
.tbtn .ico svg { width: 15px; height: 15px; }
.tbtn:hover .ico { background: #fff; border-color: var(--accent); }

/* ==========================================================================
   Card refinement — depth, a paper-like surface, and a quiet lift on hover.
   ========================================================================== */

.card {
  border-radius: 16px;
  background:
    linear-gradient(180deg, #fff 0%, #fff 62%, var(--cream-2) 100%);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 1px rgba(13,31,45,.03),
    0 2px 6px rgba(13,31,45,.04),
    0 10px 24px -12px rgba(13,31,45,.10);
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
  overflow: hidden;
}
/* a hairline of light along the top edge, the way coated stock catches it */
.card { position: relative; }
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.9) 18%,
                                        rgba(255,255,255,.9) 82%, transparent);
  pointer-events: none;
}

.card:hover {
  box-shadow:
    0 1px 1px rgba(13,31,45,.04),
    0 4px 10px rgba(13,31,45,.05),
    0 18px 38px -16px rgba(13,31,45,.16);
}

.card-head {
  background: linear-gradient(180deg, #fff, var(--cream-2));
  padding: .95rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { letter-spacing: -.005em; }
.card-head > svg {
  box-shadow: 0 1px 2px rgba(13,31,45,.05);
}

/* stat tiles get the same treatment, with their tone carried through */
.stat {
  border-radius: 16px;
  box-shadow:
    0 1px 1px rgba(13,31,45,.03),
    0 2px 6px rgba(13,31,45,.04),
    0 10px 24px -14px rgba(13,31,45,.12);
  transition: box-shadow .22s ease, transform .22s ease;
}
.stat:hover {
  transform: translateY(-2px);
  box-shadow:
    0 2px 4px rgba(13,31,45,.05),
    0 16px 34px -16px rgba(13,31,45,.20);
}
.stat-ico { box-shadow: 0 1px 3px rgba(13,31,45,.08); }

/* the matter-type chooser lifts more, since the whole card is the target */
.type-card { border-radius: 16px; }
.type-card:hover { transform: translateY(-4px); }
.type-icon { box-shadow: 0 2px 6px rgba(13,31,45,.07); }

/* panels that hold a form breathe a little more */
.card-pad { padding: 1.35rem; }

/* the navy total box on the invoice form, matched to the new radius */
.totals-box {
  border-radius: 16px;
  box-shadow: 0 10px 28px -14px rgba(13,31,45,.5);
  background:
    radial-gradient(120% 100% at 0% 0%, #17324a 0%, transparent 60%),
    linear-gradient(160deg, var(--navy), #0a1822);
}

/* the sidebar's own cards */
.nav-user { border-radius: 12px; }

@media (max-width: 640px) {
  .card, .stat, .type-card { border-radius: 13px; }
  .card-pad { padding: 1.1rem; }
}

/* Long client names should not stretch a row to six lines. The clamp lives on
   a span -- applying it to the cell itself breaks table layout. */
.clip {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 14rem;
}
@media (max-width: 640px) {
  .clip { -webkit-line-clamp: 3; max-width: none; }
}

/* ==========================================================================
   A coloured canvas.

   Everything above sits on near-white, which reads washed out. This lays a
   soft wash of the three matter colours behind the whole interface, fixed so
   it does not slide while the page scrolls.
   ========================================================================== */

body {
  background-color: #E6E0D2;
  background-image:
    radial-gradient(1100px 700px at 100% -8%, rgba(30, 78,140,.34), transparent 60%),
    radial-gradient( 950px 680px at -10% 105%, rgba(46,125,111,.32), transparent 60%),
    radial-gradient( 900px 560px at 52%  34%, rgba(201,168,76,.30), transparent 66%),
    radial-gradient( 760px 520px at 108% 95%, rgba(139, 32, 32,.18), transparent 64%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* the sidebar picks up a little of the same colour so it is not a flat slab */
.sidebar {
  background:
    radial-gradient(120% 70% at 20% 0%,  rgba(30,78,140,.35) 0%, transparent 55%),
    radial-gradient(120% 60% at 80% 100%, rgba(46,125,111,.22) 0%, transparent 60%),
    linear-gradient(178deg, var(--navy) 0%, #0a1822 100%);
  border-right: 1px solid rgba(201,168,76,.16);
}

.topbar {
  background: rgba(255,253,247,.82);
  border-bottom: 1px solid rgba(201,168,76,.35);
  box-shadow: 0 1px 0 rgba(255,255,255,.6);
}

/* cards now float above colour, so they need to stay clearly white */
.card, .stat {
  background-color: #fff;
  border-color: rgba(13,31,45,.10);
}
.card {
  background-image: linear-gradient(180deg, #fff 0%, #fff 66%, #FBF9F4 100%);
}

/* ------------------------------------------------- coloured card headers */

.card-head { border-bottom: 1px solid rgba(13,31,45,.08); }
.card-head.t-gold    { background: linear-gradient(180deg, #FEFAEE, #FDF6E3); }
.card-head.t-teal    { background: linear-gradient(180deg, #F1F9F6, var(--c-teal-tint)); }
.card-head.t-indigo  { background: linear-gradient(180deg, #F2F6FC, var(--c-indigo-tint)); }
.card-head.t-crimson { background: linear-gradient(180deg, #FDF5F5, var(--c-crimson-tint)); }
.card-head.t-plum    { background: linear-gradient(180deg, #F8F5FA, var(--c-plum-tint)); }

.card-head.t-gold    > svg { background:#fff; border-color: var(--gold);        color: var(--gold-dim); }
.card-head.t-teal    > svg { background:#fff; border-color: var(--c-teal-line); color: var(--c-teal); }
.card-head.t-indigo  > svg { background:#fff; border-color: var(--c-indigo-line);color: var(--c-indigo); }
.card-head.t-crimson > svg { background:#fff; border-color: var(--c-crimson-line);color: var(--c-crimson); }
.card-head.t-plum    > svg { background:#fff; border-color: var(--c-plum-line); color: var(--c-plum); }

.card-head.t-teal h3    { color: var(--c-teal); }
.card-head.t-indigo h3  { color: var(--c-indigo); }
.card-head.t-crimson h3 { color: var(--c-crimson); }
.card-head.t-plum h3    { color: var(--c-plum); }
.card-head.t-gold h3    { color: var(--gold-dim); }

/* ----------------------------------------------------------- table heads */

table.data th {
  background: linear-gradient(180deg, #F7F4EC, #F1EDE2);
  color: #6a6252;
  border-bottom: 1px solid rgba(13,31,45,.10);
}

/* --------------------------------------------------------- the bar strip */

.bars .bar:nth-child(1) i { background: linear-gradient(180deg, #9ad3c6, var(--c-teal)); }
.bars .bar:nth-child(2) i { background: linear-gradient(180deg, var(--gold-light), var(--gold-dim)); }
.bars .bar:nth-child(3) i { background: linear-gradient(180deg, #7fb3e0, var(--c-indigo)); }
.bars .bar:nth-child(4) i { background: linear-gradient(180deg, #c9a3d8, var(--c-plum)); }
.bars .bar:nth-child(5) i { background: linear-gradient(180deg, #e0a3a3, var(--c-crimson)); }
.bars .bar:nth-child(6) i { background: linear-gradient(180deg, #f0c98a, var(--c-amber)); }

/* --------------------------------------------------------------- chips */

.chip { background: rgba(255,255,255,.75); }
.chip.active {
  background: linear-gradient(160deg, var(--navy-500), var(--navy));
  border-color: var(--navy); color: #fff;
  box-shadow: 0 3px 10px -4px rgba(13,31,45,.6);
}

/* the search field in the top bar */
.omni-trigger { background: rgba(255,255,255,.7); }
.omni-trigger:hover { background: #fff; }

/* filter/section rules */
.divider { background: rgba(13,31,45,.08); }
