:root {
  color-scheme: light;
  --bg: #f8fafd;
  --ink: #161d1d;
  --muted: #5e6a6b;
  --line: #d8e3e4;
  --surface: #ffffff;
  --surface-2: #edf7f2;
  --primary: #005a5f;
  --primary-ink: #ffffff;
  --accent: #7b3ff2;
  --approve: #0b6b3a;
  --decline: #b3261e;
  --warn: #8a5300;
  --shadow: 0 18px 50px rgba(22, 29, 29, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(123, 63, 242, .12), transparent 24rem),
    linear-gradient(135deg, #f9fbff 0%, #eef8f5 55%, #fff8ec 100%);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

label {
  display: grid;
  gap: .45rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  padding: .9rem 1rem;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 90, 95, .12);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-card,
.settings-panel {
  width: min(100%, 560px);
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 2rem;
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 900;
  letter-spacing: .04em;
}

.login-card h1,
.settings-panel h1,
.queue h1,
.review h2 {
  margin: .65rem 0 .25rem;
  letter-spacing: 0;
  line-height: 1.04;
}

.login-card p,
.queue p,
.eyebrow {
  margin: 0;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 18px;
  padding: 0 1rem;
  background: #102526;
  color: white;
  font-weight: 900;
}

nav {
  display: flex;
  gap: .35rem;
  align-items: center;
  overflow-x: auto;
}

nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 .95rem;
  color: var(--muted);
  font-weight: 800;
}

nav a.active,
nav a:hover {
  background: #d8f0ed;
  color: var(--primary);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 1rem;
  padding: 0 1.25rem 1.25rem;
  min-height: calc(100vh - 72px);
}

.queue,
.review,
.settings-panel {
  background: rgba(255, 255, 255, .76);
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.queue {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
}

.pulse {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--approve);
  box-shadow: 0 0 0 8px rgba(11, 107, 58, .12);
}

.table-like {
  display: grid;
  gap: .5rem;
  padding: 0 .75rem .75rem;
  overflow-y: auto;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .35rem .65rem;
  align-items: center;
  border-radius: 20px;
  border: 1px solid transparent;
  padding: .85rem;
  background: rgba(255, 255, 255, .66);
}

.row small {
  color: var(--muted);
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row.selected,
.row:hover {
  border-color: #b8deda;
  background: #effaf7;
}

.status {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 .7rem;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  background: #e8eef0;
  color: #415052;
}

.status.new {
  background: #fff0c2;
  color: var(--warn);
}

.status.approved {
  background: #c7f1d9;
  color: var(--approve);
}

.status.declined {
  background: #ffd9d4;
  color: var(--decline);
}

.status.big {
  min-height: 38px;
  padding-inline: 1rem;
}

.review {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.review-head {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.split-view {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 0;
  min-height: 0;
  flex: 1;
}

.pdf-pane {
  min-height: 72vh;
  border-right: 1px solid var(--line);
  background: #cfd8dc;
}

.pdf-pane iframe {
  width: 100%;
  height: 100%;
  min-height: 72vh;
  border: 0;
  display: block;
}

.invoice-pane {
  padding: 1.25rem;
  overflow-y: auto;
}

.invoice-pdf-pane {
  display: grid;
  grid-template-rows: minmax(72vh, 1fr) auto;
  gap: 0;
  padding: 0;
  background: #d7dee0;
  overflow: hidden;
}

.invoice-pdf-pane iframe {
  width: 100%;
  height: 100%;
  min-height: 72vh;
  border: 0;
  display: block;
  background: #fff;
}

.decision-form {
  margin: 0;
  padding: 1rem;
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid var(--line);
}

.meta-strip.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.meta-strip,
.totals {
  display: grid;
  gap: .65rem;
  margin-bottom: 1rem;
}

.meta-strip span,
.totals span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 18px;
  background: var(--surface-2);
  padding: .8rem .9rem;
  color: var(--muted);
}

.meta-strip b,
.totals b {
  color: var(--ink);
  text-align: right;
}

.invoice-form,
.settings-wrap {
  display: grid;
  gap: 1rem;
}

.settings-wrap {
  place-items: start center;
  padding: 1rem 1.25rem 2rem;
}

.settings-panel {
  width: min(100%, 920px);
}

.grid-two,
.grid-three {
  display: grid;
  gap: 1rem;
}

.grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.2rem;
  font-weight: 950;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.btn.primary,
.btn.approve {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 10px 22px rgba(0, 90, 95, .22);
}

.btn.approve {
  background: var(--approve);
}

.btn.decline {
  background: var(--decline);
  color: #fff;
  box-shadow: 0 10px 22px rgba(179, 38, 30, .18);
}

.btn.ghost {
  background: #e9f0f1;
  color: #314244;
}

.alert {
  border-radius: 18px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  font-weight: 800;
}

.alert.danger {
  background: #ffe9e6;
  color: var(--decline);
}

.alert.warning {
  margin: 1rem;
  background: #fff1cf;
  color: var(--warn);
}

.alert.ok {
  background: #ddf8e8;
  color: var(--approve);
}

.empty {
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}

.empty.large {
  margin: auto;
  font-weight: 900;
}

.switch {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .7rem;
}

.switch input {
  width: 22px;
  height: 22px;
}

.totals-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .84);
}

.totals-panel {
  display: grid;
  gap: .9rem;
  padding: 1rem 1.25rem 1.25rem;
}

.totals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.totals-head h3 {
  margin: 0;
  font-size: 1rem;
}

.totals-head p {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.hours-table {
  display: grid;
  gap: .35rem;
}

.hours-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) .55fr .75fr .7fr .7fr;
  align-items: center;
  gap: .75rem;
  min-height: 52px;
  border-radius: 16px;
  background: #f5faf8;
  padding: .6rem .75rem;
}

.hours-header {
  min-height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hours-row small {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.25;
}

.hours-row input {
  min-height: 40px;
  border-radius: 14px;
  padding: .5rem .65rem;
}

.overdrawn {
  color: var(--decline);
  font-weight: 900;
}

@media (max-width: 1100px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .queue {
    max-height: 34vh;
  }

  .split-view {
    grid-template-columns: 1fr;
  }

  .pdf-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    padding: .75rem;
    align-items: stretch;
    flex-direction: column;
  }

  .app-grid,
  .settings-wrap {
    padding: .75rem;
  }

  .grid-two,
  .grid-three,
  .hours-row {
    grid-template-columns: 1fr;
  }

  .review-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-pane,
  .pdf-pane iframe {
    min-height: 58vh;
  }
}
