:root {
  --ink: #0c182e;
  --ink-2: #11203c;
  --ink-3: #1a2d50;
  --azure: #0592c5;
  --sky: #53b9cf;
  --flame: #e1522a;
  --text: #e8eef7;
  --muted: #8fa3c0;
  --line: #243a63;
  --ok: #3fb97f;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.45;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0 0 .6rem; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
.eyebrow { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--sky); margin-bottom: .4rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1rem; background: var(--ink-2); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.brand-sub { color: var(--sky); font-family: var(--mono); font-size: .8rem; margin-left: .4rem; }
.nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.nav button {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: .5rem .8rem; border-radius: 8px; font: inherit; cursor: pointer; min-height: 44px;
}
.nav button:hover { color: var(--text); }
.nav button.active { color: var(--text); border-color: var(--azure); }

.app { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 6rem; }

.card {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem; margin-bottom: 1rem; position: relative;
}
.card::before, .card::after {
  content: ""; position: absolute; width: 12px; height: 12px; border: 2px solid var(--azure); opacity: .7;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .row, .row-3 { grid-template-columns: 1fr; }
}

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--text); font-size: 1rem; min-height: 44px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; min-height: 44px;
  background: var(--ink); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  font: inherit;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--sky); outline-offset: 1px;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--azure); }
textarea { min-height: 90px; resize: vertical; }

.btn {
  background: var(--ink-3); color: var(--text); border: 1px solid var(--line);
  padding: .6rem 1rem; min-height: 44px; border-radius: 8px; font: inherit; cursor: pointer;
}
.btn:hover { border-color: var(--sky); }
.btn.primary { background: var(--azure); border-color: var(--azure); color: #fff; font-weight: 650; }
.btn.primary:hover { background: #07a3dc; }
.btn.small { min-height: 36px; padding: .3rem .7rem; font-size: .85rem; }
.btn.danger { border-color: var(--flame); color: var(--flame); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.xero-send { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.xero-send select { width: auto; margin-top: 0; flex: 1 1 10rem; }

.total-box { text-align: center; padding: 1rem 0 .5rem; }
.total-big { font-size: 3rem; font-weight: 750; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.total-note { color: var(--sky); font-family: var(--mono); font-size: .8rem; min-height: 1.2em; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--sky); font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.errors { background: rgba(225, 82, 42, .12); border: 1px solid var(--flame); color: #ffb9a3; border-radius: 8px; padding: .6rem .8rem; margin-bottom: .75rem; }
.errors ul { margin: 0; padding-left: 1.1rem; }
.notice { background: rgba(5, 146, 197, .14); border: 1px solid var(--azure); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .75rem; }
pre.breakdown { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: pre-wrap; margin: .5rem 0 0; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; border: 1px solid var(--line); }
.pill.draft { color: var(--muted); }
.pill.sent { color: var(--sky); border-color: var(--sky); }
.pill.accepted { color: var(--ok); border-color: var(--ok); }
.pill.declined { color: var(--flame); border-color: var(--flame); }

.similar { display: flex; gap: .75rem; flex-wrap: wrap; }
.similar .item { flex: 1 1 200px; border: 1px dashed var(--line); border-radius: 8px; padding: .6rem .8rem; }
.similar .amt { font-size: 1.3rem; font-weight: 700; }

.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.toolbar input, .toolbar select { margin-top: 0; width: auto; flex: 1 1 160px; }

.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: var(--ink-3); border: 1px solid var(--sky); color: var(--text);
  padding: .7rem 1.1rem; border-radius: 10px; z-index: 50; max-width: 90vw;
}
.toast.error { border-color: var(--flame); }

/* Feedback widget: muted pill, bottom-left. */
.fb-pill {
  position: fixed; left: 12px; bottom: 12px; z-index: 40; opacity: .75;
  background: var(--ink-3); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: .45rem .9rem; min-height: 40px; font: inherit; font-size: .85rem; cursor: pointer;
}
.fb-pill:hover, .fb-pill:focus-visible { opacity: 1; color: var(--text); }
.fb-modal-bg {
  position: fixed; inset: 0; background: rgba(5, 10, 20, .7); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.fb-modal { background: var(--ink-2); border: 1px solid var(--azure); border-radius: 12px; padding: 1rem; width: 100%; max-width: 440px; }

/* Quotes list: scroll inside .table-wrap on small screens instead of squeezing the columns. */
table.wide { min-width: 560px; }
.row-actions { display: flex; gap: .4rem; flex-wrap: nowrap; }
.grid-2 > * { min-width: 0; } /* let wide children (table-wrap, pre) shrink instead of stretching the page */

@media (max-width: 600px) {
  .col-by { display: none; }
  /* Quotes list stacks into one card per quote, so Open/Delete stay on screen. */
  table.wide { min-width: 0; }
  table.wide thead { display: none; }
  table.wide tr { display: grid; grid-template-columns: auto 1fr auto; gap: .25rem .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line, #22324f); }
  table.wide td { display: block; border: 0; padding: 0; }
  table.wide td:nth-child(2) { grid-column: 2 / 4; }
  table.wide td:nth-child(6) { grid-column: 1 / 3; }
  table.wide td:last-child { grid-column: 3; grid-row: 3; justify-self: end; }
}
@media (max-width: 420px) {
  .topbar { padding: .5rem .75rem; }
  .nav button { padding: .5rem .6rem; }
  .app { padding: .75rem .75rem 6rem; }
  .actions .btn { flex: 1 1 100%; }
  .total-big { font-size: 2.4rem; }
}
