/* Mimir / Fonn Group identity: Manrope, teal for the primary action and the
   selected state, plum for chrome. Text in ink, never in teal. */
:root {
  --teal: #159AB2;
  --teal-text: #0C485C;
  --teal-fill: #DEF1F4;
  --plum: #474056;
  --plum-light: #6A5F81;
  --page: #F7F0F0;
  --surface: #FFFFFF;
  --ink: #071627;
  --muted: #5F5E5A;
  --border: rgba(10, 12, 8, 0.12);
  --border-strong: rgba(10, 12, 8, 0.24);
  --strong: #1E7F4F;  --strong-fill: #E3F6EA;
  --possible: #8A6A12; --possible-fill: #FBF1D6;
  --weak: #5F5E5A;    --weak-fill: #EFEDE7;
  --none: #8B8A85;    --none-fill: #F4F3EF;
  --danger: #A63A2B;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --teal: #3DB5CB;
    --teal-text: #9ADCE8;
    --teal-fill: #11343D;
    --plum: #2A2533;
    --plum-light: #9A8FB3;
    --page: #121316;
    --surface: #1B1C20;
    --ink: #ECEAE6;
    --muted: #A8A6A0;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.22);
    --strong: #6FD99C;  --strong-fill: #173527;
    --possible: #E6C266; --possible-fill: #3A3017;
    --weak: #B9B7B0;    --weak-fill: #2A2A2C;
    --none: #85837E;    --none-fill: #222225;
    --danger: #F08C7C;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}
[hidden] { display: none !important; }
a { color: var(--teal-text); }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.5em; margin: 0; }

button { cursor: pointer; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); padding: 6px 12px; }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; padding: 10px 16px; }
button.ghost { background: transparent; }
.button-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select { border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; background: var(--surface); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--teal); margin: 0 6px 0 0; }

textarea { font: inherit; color: inherit; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; background: var(--surface); width: 100%; resize: vertical; }
h1, h2, h3 { line-height: 1.25; }

/* ---------------------------------------------------------------- sign-in */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.signin-hero { background: var(--plum); color: #F7F0F0; padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.signin-logo { height: 44px; width: auto; align-self: flex-start; }
.signin-emblem { width: min(320px, 70vw); height: auto; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.35); margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home-hero { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; }
.home-hero img { width: 88px; height: 88px; border-radius: 12px; flex: none; }
.home-hero h1 { font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.home-hero .lead { margin: 0; }
.signin-hero h1 { font-size: 44px; font-weight: 800; margin: 12px 0 0; letter-spacing: -.01em; }
.signin-hero p { font-size: 18px; margin: 0; max-width: 28em; color: #E4E0EA; }
.signin-products { --logo-h: 26px; display: flex; gap: 24px; align-items: flex-start; margin-top: 24px; flex-wrap: wrap; }
.signin-products img { height: var(--logo-h); width: auto; opacity: .9; }
/* The three logos share an x-height, but Saga's baseline sits 20 of 72 px above
   the image bottom (the g descends) where Mimir's and TEIKNA's sit at the
   bottom: shift Saga down so all three stand on one line. */
.signin-products img[alt="Saga"] { margin-top: calc(var(--logo-h) * 20 / 72); }
.signin-panel { display: grid; place-items: center; padding: 32px 16px; }
.signin-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }
.signin-card h2 { margin: 0; }
.signin-card p { margin: 0; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 11px 16px; font-weight: 600; background: var(--surface);
}
.google-btn:hover { border-color: var(--teal); }
.notice { background: var(--possible-fill); color: var(--ink); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: 14px; }
@media (max-width: 760px) {
  .signin { grid-template-columns: 1fr; }
  .signin-hero { padding: 32px 20px; }
  .signin-hero h1 { font-size: 34px; }
  .signin-emblem { width: min(220px, 60vw); }
}

/* ----------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--plum); color: #F7F0F0;
  position: sticky; top: 0; z-index: 5;
}
.topbar .muted { color: #CFCAD9; }
.topbar button { color: #F7F0F0; border-color: rgba(255,255,255,.3); }
.brand { font-weight: 800; display: flex; align-items: center; gap: 12px; color: #F7F0F0; text-decoration: none; }
.brand .logo { height: 32px; width: auto; display: block; }
.brand span { padding-left: 12px; border-left: 1px solid rgba(255,255,255,.3); line-height: 1.2; font-size: 17px; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }
.nav-toggle { display: none; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 52px); }
.nav { border-right: 1px solid var(--border); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 52px; align-self: start; max-height: calc(100vh - 52px); overflow-y: auto; }
.nav h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 12px 6px; display: flex; align-items: center; gap: 8px; }
.nav h3 img { height: 16px; width: auto; }
.nav h3.nav-product { margin-top: 20px; }
.nav h3.nav-product img { height: 20px; }
/* Saga's g descends below the line (see .signin-products): line it up with the others. */
.nav h3.nav-product img[alt="Saga"] { margin-bottom: calc(-20px * 20 / 72); }
.nav a { color: var(--ink); text-decoration: none; padding: 7px 12px; border-radius: 8px; border-left: 3px solid transparent; font-size: 14px; }
.nav a:hover { background: var(--surface); }
.nav a[aria-current=page] { background: var(--surface); border-left-color: var(--teal); font-weight: 600; }
.nav .soon { font-size: 11px; color: var(--muted); margin-left: 6px; }
.view { padding: 28px 32px 56px; min-width: 0; max-width: 1180px; }
.view > h1 { font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 46em; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .top-right #who { display: none; }
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav:not(.open) { display: none; }
  .view { padding: 20px 16px 48px; }
}

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; min-width: 0; }
.card h2 { font-size: 18px; margin: 0 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: grid; gap: 10px; align-content: start; }
.tile img { height: 26px; width: auto; justify-self: start; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; }
.tile .links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; }
@media (max-width: 860px) { .tiles { grid-template-columns: 1fr; } }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 5px 12px; }
.seg button[aria-pressed=true] { background: var(--teal); color: #fff; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; background: var(--teal-fill); color: var(--teal-text); }
.pill.warn { background: var(--possible-fill); color: var(--possible); }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 12px; }

/* ------------------------------------------------------------ price lists */
.table-wrap { overflow-x: auto; }
table.prices, table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.prices th, table.plain th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
table.prices td, table.plain td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.prices td.num, table.prices th.num, table.plain td.num, table.plain th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.prices .name { font-weight: 600; min-width: 160px; }
table.prices .desc { color: var(--muted); max-width: 46em; }
table.prices .comment { font-size: 13px; color: var(--possible); margin-top: 4px; }
table.prices input, table.prices textarea { font-size: 13px; padding: 5px 7px; }
table.prices input.num { text-align: right; width: 96px; }
.edit-actions { position: sticky; bottom: 0; background: var(--page); padding: 12px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------- calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .calc { grid-template-columns: 1fr; } }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.fields label { font-size: 14px; }
.fields .hint { display: block; font-size: 12px; color: var(--muted); }
.fields input { text-align: right; width: 110px; }
.result { position: sticky; top: 72px; }
.result td.group { font-weight: 700; padding-top: 16px; border-bottom: 0; }
.result .detail { display: block; font-size: 12px; color: var(--muted); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.total { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.total .label { font-size: 12px; color: var(--muted); }
.total .value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.warnings { margin: 12px 0 0; padding-left: 18px; color: var(--possible); font-size: 13px; }

/* ------------------------------------------------------------------ admin */
.row-form { display: grid; grid-template-columns: minmax(0, 2fr) 140px auto; gap: 10px; align-items: center; }
@media (max-width: 640px) { .row-form { grid-template-columns: 1fr; } }
table.plain td.num select { width: auto; }
table.plain td.num { white-space: nowrap; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 4px; font-size: 14px; cursor: pointer; }
.check-row input { margin-top: 3px; }
.check-row .hint { display: block; font-size: 12px; color: var(--muted); }
.fields select { width: min(260px, 52vw); }
table.plain.inputs input { width: 100px; text-align: right; }
table.plain.inputs td { vertical-align: middle; }
.notice-card { border-color: var(--possible); background: var(--possible-fill); }
.notice-card h2 { color: var(--ink); }
.aws-ok { margin: 0 0 12px; }
.product-picker { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.product-check { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.product-check img { height: 16px; width: auto; }
.product-check input:not(:checked) + img { opacity: .35; filter: grayscale(1); }
.picker-row { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.discount-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px auto; gap: 8px; align-items: center; margin: 8px 0; font-size: 14px; }
.discount-row .hint { display: block; font-size: 12px; color: var(--muted); }
.discount-row input { text-align: right; }
.discount-row select:first-child { grid-column: 1 / 4; }
.detail.discount { color: var(--strong); }
@media (max-width: 640px) { .discount-row { grid-template-columns: 1fr 1fr; } .discount-row select:first-child { grid-column: 1 / -1; } }
table.plain.terms { margin-top: 12px; }
table.plain.terms td.num, table.plain.terms th.num { min-width: 110px; }
table.plain.terms tr.discount-row-total td { color: var(--strong); }
table.plain.terms tr.net-row td { font-weight: 800; font-size: 16px; border-bottom: 0; }
