/* helloContra design system.
 *
 * One stylesheet for the whole application, so Login, Dashboard, Customers,
 * Estimates and Invoices cannot drift into looking like different products.
 *
 * Conventions that matter for an accounting product:
 *   - Money uses tabular figures and is right aligned, so columns of numbers line
 *     up digit for digit and a wrong magnitude is visible at a glance.
 *   - Colour carries no meaning on its own. Every status pill has a word in it.
 *   - No animation beyond a hover transition. Ledger work is read, not watched.
 */

:root {
  --ink:        #0B1220;
  --ink-2:      #1B2537;
  --body:       #34405A;
  --muted:      #6B7A93;
  --dim:        #94A2B8;
  --line:       #E3E8EF;
  --line-soft:  #EEF1F6;
  --bg:         #F6F7F9;
  --surface:    #FFFFFF;

  --accent:      #0E7C66;
  --accent-deep: #0A5F4E;
  --accent-soft: #E7F3F0;

  --warn:      #A93209;
  --warn-soft: #FCEDE7;
  --info-soft: #EAF0FB;
  --info:      #2C4E9A;

  --radius:   10px;
  --radius-s: 7px;
  --shadow:   0 1px 2px rgba(11,18,32,.05), 0 8px 24px -12px rgba(11,18,32,.12);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: -.011em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.0rem; }

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .86em; }
.dim { color: var(--dim); }
.r { text-align: right; }
.center { text-align: center; }
.inline { display: inline; }

.mark { width: 28px; height: 28px; color: var(--ink); display: block; }

/* ----------------------------------------------------------- auth screens */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}
.auth-card.narrow { max-width: 360px; text-align: center; }
.auth-card.narrow .auth-brand { justify-content: center; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: -.01em;
  margin-bottom: 26px;
}

.auth-card h1 { margin-bottom: 4px; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 22px; }

.err-code { font-size: 2.6rem; letter-spacing: -.03em; margin-bottom: 6px; }

label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 0 6px;
}

input[type=email], input[type=password], input[type=text] {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font: inherit;
  color: var(--ink);
  background: var(--surface);
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.alert {
  background: var(--warn-soft);
  border: 1px solid #F3D3C6;
  color: var(--warn);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: .875rem;
  margin-bottom: 18px;
}

.fine { color: var(--dim); font-size: .78rem; margin: 18px 0 0; }

/* ----------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-s);
  font: inherit;
  font-weight: 550;
  font-size: .875rem;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover:not(:disabled) { background: #FAFBFC; border-color: #D3DAE5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn.wide { width: 100%; margin-top: 4px; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--ink); }

/* ----------------------------------------------------------- pick lists */

.pick { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }

.pick-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-s);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.pick-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.pick-name { font-weight: 550; }
.pick-go { color: var(--dim); }

/* ----------------------------------------------------------- app shell */

.app { display: flex; min-height: 100vh; }

.side {
  width: 232px;
  flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--ink);
  font-size: 1.02rem;
  letter-spacing: -.01em;
  padding: 0 6px 22px;
}
.brand:hover { text-decoration: none; }

.nav { display: grid; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  color: var(--body);
  font-size: .9rem;
  font-weight: 500;
}
.nav-item .ico { color: var(--dim); font-size: .8rem; }
a.nav-item:hover { background: var(--line-soft); text-decoration: none; color: var(--ink); }
.nav-item.on { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.nav-item.on .ico { color: var(--accent); }

.nav-item.soon { color: var(--dim); cursor: default; }
.nav-item.soon em {
  margin-left: auto;
  font-style: normal;
  font-size: .66rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.side-foot { margin-top: auto; padding: 12px 6px 0; }
.book-chip {
  font-size: .78rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  height: 58px;
  flex: 0 0 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}
.top-left, .top-right { display: flex; align-items: center; gap: 14px; min-width: 0; }

.ctx { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.ctx-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}
.ctx strong { color: var(--ink); font-weight: 600; font-size: .92rem; }

.who { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 29px; height: 29px;
  flex: 0 0 29px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .02em;
}
.who-text { display: flex; flex-direction: column; line-height: 1.25; }
.who-text strong { color: var(--ink); font-size: .85rem; font-weight: 600; }
.who-text small { color: var(--dim); font-size: .72rem; }

.content { padding: 26px 24px 48px; max-width: 1180px; }

/* ----------------------------------------------------------- page head */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head .sub { margin: 3px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------- first run */

/* A soft tinted panel rather than a card with a coloured bar down one side. The
 * side bar is a template tell, and it also says "warning" in most interfaces,
 * which is the wrong note for a book that is simply new and working correctly. */
.firstrun {
  background: var(--accent-soft);
  border: 1px solid #C7E3DC;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.firstrun h2 { margin-bottom: 6px; }
.firstrun p { margin: 0 0 16px; color: var(--muted); font-size: .9rem; max-width: 62ch; }

.firstrun-facts { display: flex; gap: 32px; margin: 0; flex-wrap: wrap; }
.firstrun-facts dt {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
  margin-bottom: 2px;
}
.firstrun-facts dd { margin: 0; color: var(--ink); font-weight: 600; }

/* ----------------------------------------------------------- metric cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card.alarm { border-color: #F0CFC2; background: linear-gradient(0deg, var(--warn-soft), var(--surface) 60%); }

.card-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
}
.card-value {
  font-size: 1.55rem;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.15;
}
.card.alarm .card-value { color: var(--warn); }
.card-note { font-size: .78rem; color: var(--dim); }

/* ----------------------------------------------------------- panels */

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.count { font-size: .78rem; color: var(--dim); }

.empty { padding: 26px 16px; color: var(--dim); font-size: .88rem; text-align: center; margin: 0; }

/* ----------------------------------------------------------- tables */

.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tbl th {
  text-align: left;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #FCFCFD;
  white-space: nowrap;
}
.tbl td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--body);
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #FCFCFD; }
.tbl td.num, .tbl th.r { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- status pills */

.pill {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill.ok     { background: var(--accent-soft); color: var(--accent-deep); border-color: #C7E3DC; }
.pill.warn   { background: var(--warn-soft);   color: var(--warn);        border-color: #F0CFC2; }
.pill.info   { background: var(--info-soft);   color: var(--info);        border-color: #CFDCF4; }
.pill.muted  { background: var(--line-soft);   color: var(--muted);       border-color: var(--line); }

/* ----------------------------------------------------------- narrow screens */

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side {
    width: 100%;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
  }
  .brand { padding-bottom: 12px; }
  .nav { grid-auto-flow: column; overflow-x: auto; gap: 6px; }
  .nav-item { white-space: nowrap; }
  .nav-item.soon em { display: none; }
  .side-foot { display: none; }
  .top { padding: 0 16px; height: auto; flex: none; padding-block: 12px; flex-wrap: wrap; }
  .content { padding: 18px 16px 40px; }
  .who-text { display: none; }
  .split { grid-template-columns: 1fr; }
}

/* Money and date columns never wrap. A figure broken across two lines is a figure
 * that cannot be compared with the one above it. */
.tbl td.num, .tbl td.nowrap, .tbl th.r { white-space: nowrap; }
.tbl td.mono { white-space: nowrap; }
