/* Hooda & Co -- Chamber Billing.
   Palette, typography and component shapes deliberately match the Chamber
   Tasks app so the two feel like one set of tools. Dark theme only, every
   colour painted explicitly so nothing is inherited from the host. */

:root {
  --navy:      #1B3A5C;
  --navy-deep: #16304C;
  --gold:      #E8B33D;

  --bg:        #0E1620;
  --surface:   #17222E;
  --surface-2: #1E2B39;
  --border:    #2A3846;
  --text:      #E7EDF3;
  --muted:     #93A3B4;
  --danger:    #FF7F70;
  --danger-bg: #3A1E1B;
  --ok:        #5BD08D;
  --ok-bg:     #102A1D;
  --warn:      #E8B33D;
  --warn-bg:   #2E2413;

  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--gold); }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--navy);
  border-bottom: 1px solid rgba(0,0,0,.35);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 940px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
}
.topbar .mark { width: 34px; height: 34px; border-radius: 7px; flex: 0 0 auto; }
.wordmark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px; color: #fff; letter-spacing: .3px; line-height: 1.1;
}
.wordmark small {
  display: block; font-family: inherit; font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; color: #9FB6CC; margin-top: 2px;
}

/* ---------- Nav ---------- */
nav {
  background: var(--navy-deep);
  position: sticky; top: 59px; z-index: 29;
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 940px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 2px; align-items: stretch;
}
nav a {
  padding: 11px 15px; text-decoration: none; color: #A9BDD1;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
nav a:hover { color: #fff; }
nav a.active { color: var(--gold); border-bottom-color: var(--gold); }
nav .spacer { flex: 1 1 auto; }
nav a.subtle { font-weight: 500; color: var(--muted); }

/* ---------- Layout ---------- */
main { max-width: 940px; margin: 0 auto; padding: 26px 20px 80px; }

h1 { font-size: 22px; font-weight: 600; letter-spacing: .2px; }
h2 { font-size: 16px; font-weight: 600; margin-top: 30px; }
.subtle { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 18px;
}
.card + .card { margin-top: 14px; }
.card-tight { padding: 14px 16px; }

/* ---------- Case context banner ---------- */
/* Sticks under the nav so the matter you're working on is never in doubt --
   the flow moves between fetch, review and bill, and losing track of which
   case you're on is how a bill ends up on the wrong matter. */
.case-bar {
  position: sticky; top: 100px; z-index: 28;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.case-bar .label {
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); font-weight: 700;
}
.case-bar .case-no { font-weight: 700; font-size: 15px; }
.case-bar .case-meta { color: var(--muted); font-size: 13px; }
.case-bar .case-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Step rail ---------- */
.steps { display: flex; gap: 6px; margin: 4px 0 20px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted);
  padding: 6px 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
}
.step .n {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.step.done { color: var(--ok); border-color: rgba(91,208,141,.35); }
.step.done .n { background: var(--ok); color: #08130D; }
.step.current { color: var(--gold); border-color: rgba(232,179,61,.45); background: var(--warn-bg); }
.step.current .n { background: var(--gold); color: #23180A; }

/* ---------- Forms ---------- */
label {
  display: block; margin-top: 18px; margin-bottom: 2px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
label:first-child { margin-top: 0; }

input[type=text], input[type=number], input[type=password], input[type=email],
input[type=date], input[type=file], input[type=search], textarea, select {
  width: 100%; padding: 11px 12px; margin-top: 5px;
  font-size: 15px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); color: var(--text);
}
textarea { min-height: 68px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6D7F91; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%2393A3B4' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 34px;
}

.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1 1 220px; min-width: 0; }

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; }
.checkbox-row label { margin: 0; font-weight: 500; color: var(--muted); font-size: 13.5px; }
.checkbox-row input { width: auto; margin: 2px 0 0; accent-color: var(--gold); }

/* ---------- Buttons ---------- */
button, .btn {
  margin-top: 20px; padding: 12px 22px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  background: var(--gold); color: #23180A;
  border: none; border-radius: 9px; cursor: pointer;
  display: inline-block; text-decoration: none; text-align: center;
}
button:hover, .btn:hover { background: #F0C055; }
button:active, .btn:active { background: #D2A032; }

.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); font-weight: 600;
}
.btn-ghost:hover { background: var(--surface-2); color: #fff; }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); font-weight: 600; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }

.btn-sm { padding: 7px 13px; font-size: 13px; margin-top: 0; border-radius: 7px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
th, td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; }
th { background: var(--surface-2); font-size: 11.5px; letter-spacing: .07em;
     text-transform: uppercase; color: var(--muted); font-weight: 700; }
tbody tr:hover td { background: rgba(255,255,255,.02); }

.effective { color: var(--ok); font-weight: 600; }
.non-effective { color: var(--muted); }
.excluded { color: #5C6B7A; text-decoration: line-through; }
.pending { color: var(--gold); font-weight: 600; }

/* ---------- Badges & flashes ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.chamber-badge { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(91,208,141,.3); }
.no-chamber-badge { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,127,112,.3); }

.flash {
  margin-top: 16px; padding: 12px 15px; border-radius: 9px;
  font-size: 13.5px; border: 1px solid;
}
.flash.success { background: var(--ok-bg); color: var(--ok); border-color: rgba(91,208,141,.35); }
.flash.error   { background: var(--danger-bg); color: var(--danger); border-color: rgba(255,127,112,.35); }
.flash.warn    { background: var(--warn-bg); color: var(--gold); border-color: rgba(232,179,61,.35); }

/* ---------- Search select ---------- */
.search-select { position: relative; margin-top: 5px; }
.search-select .search-input { margin-top: 0; }

.search-select .suggestions {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  max-height: 300px; overflow-y: auto; display: none;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
}
.search-select .suggestions.visible { display: block; }

.search-select .suggestion-item {
  padding: 10px 13px; cursor: pointer;
  border-bottom: 1px solid rgba(42,56,70,.6);
}
.search-select .suggestion-item:last-child { border-bottom: none; }
.search-select .suggestion-item:hover,
.search-select .suggestion-item.highlighted { background: var(--navy); }
.search-select .suggestion-item .primary { font-weight: 600; font-size: 14px; }
.search-select .suggestion-item .secondary { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.search-select .suggestion-item mark { background: rgba(232,179,61,.28); color: var(--gold); border-radius: 2px; }
.search-select .suggestion-empty { padding: 14px; color: var(--muted); font-size: 13px; }
.search-select .suggestion-more {
  padding: 8px 13px; color: var(--muted); font-size: 12px;
  background: var(--surface); border-top: 1px solid var(--border);
}

.search-select .selected-tag {
  display: none; margin-top: 6px; padding: 10px 12px;
  background: var(--navy); border: 1px solid rgba(232,179,61,.3);
  border-radius: 9px; align-items: center; gap: 10px;
}
.search-select .selected-tag.visible { display: flex; }
.search-select .selected-tag .tag-label { flex: 1 1 auto; font-weight: 600; font-size: 14px; }
.search-select .selected-tag .tag-sub { color: #9FB6CC; font-size: 12.5px; font-weight: 400; display: block; }
.search-select .selected-tag button {
  margin: 0; padding: 5px 11px; font-size: 12px; flex: 0 0 auto;
  background: transparent; color: var(--gold); border: 1px solid rgba(232,179,61,.45);
  border-radius: 7px; font-weight: 600;
}
.search-select .selected-tag button:hover { background: rgba(232,179,61,.12); }

/* ---------- Order review ---------- */
.order-card { border: 1px solid var(--border); border-radius: 11px; padding: 16px; margin-top: 14px; background: var(--surface); }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-date { font-weight: 700; font-size: 15px; }
.order-text {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.55; background: var(--bg); color: #C7D4E0;
  padding: 12px; border-radius: 8px; margin-top: 11px;
  max-height: 210px; overflow-y: auto; border: 1px solid var(--border);
}

/* ---------- Login / setup ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(168deg, var(--navy) 0%, #102437 55%, var(--bg) 100%);
}
.auth-mark { width: 74px; height: 74px; margin-bottom: 16px; border-radius: 14px; }
.brand { font-family: Georgia, "Times New Roman", serif; font-size: 26px; color: #fff; text-align: center; }
.brand-sub {
  color: #9FB6CC; margin: 5px 0 24px; font-size: 12px;
  letter-spacing: .13em; text-transform: uppercase; text-align: center;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  padding: 24px; border-radius: 12px; width: 100%; max-width: 400px;
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.auth-card button { width: 100%; }

/* ---------- Misc ---------- */
.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -1px; margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: 22px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 10px; margin-top: 14px; font-size: 13.5px;
}

@media (max-width: 620px) {
  nav a { padding: 10px 11px; font-size: 12.5px; }
  .case-bar { top: 96px; }
  main { padding: 18px 14px 70px; }
}
