:root {
  --gold: #c9a962;
  --gold-soft: #d8c489;
  --gold-dim: #a68b4b;
  --dark: #1a1a1a;
  --ink: #2a2a2a;
  --gray: #6b6b6b;
  --line: #e6e1d4;
  --bg: #faf9f6;
  --card: #ffffff;
  --field-bg: #f6f4ee;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "DM Sans", -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
}

/* sidebar */
.sidebar {
  width: 232px;
  min-height: 100vh;
  background: #14130f;
  color: #e9e6dd;
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
}
.brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 30px; padding-left: 6px; }
.wm { font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-size: 26px; font-weight: 400; letter-spacing: .3px; }
.wm-dark { color: #f4f1e8; }
.wm-gold { color: var(--gold); }
.tagline { font-size: 9px; letter-spacing: 3px; color: var(--gold-soft); align-self: center; }

nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  text-align: left; background: transparent; border: 0; color: #cfcabb;
  padding: 10px 12px; border-radius: 7px; font-size: 14px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-item:hover:not(.disabled) { background: #232118; color: #fff; }
.nav-item.active { background: var(--gold); color: #1a1505; font-weight: 600; }
.nav-item.disabled { color: #6c685c; cursor: default; }
.nav-item em { font-style: normal; font-size: 9px; letter-spacing: 1.5px; opacity: .7; text-transform: uppercase; }

.sidefoot { margin-top: auto; padding-left: 6px; }
.status { font-size: 11px; color: #8a8576; }
.status.ok { color: var(--gold-soft); }
.status.bad { color: #d98c7a; }

/* content */
.content { flex: 1; padding: 44px 56px; max-width: 880px; }
.panel { display: none; }
.panel.active { display: block; }

h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 30px; margin: 0 0 8px; color: var(--dark); }
h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 21px; margin: 34px 0 12px; color: var(--dark); }
.lead { color: var(--gray); font-size: 14px; line-height: 1.55; max-width: 620px; margin: 0 0 24px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 24px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
input[type=text] {
  width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--field-bg); color: var(--ink);
}
input[type=text]:focus { outline: none; border-color: var(--gold-soft); background: #fff; }
select {
  width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--field-bg); color: var(--ink); cursor: pointer;
}
select:focus { outline: none; border-color: var(--gold-soft); background: #fff; }
.spacer { height: 16px; }
.hint { font-size: 12px; color: var(--gray); margin: 8px 0 18px; }

.btn-primary {
  background: var(--gold); color: #1a1505; border: 0; font-weight: 600; font-size: 14px;
  padding: 11px 20px; border-radius: 8px; cursor: pointer;
}
.btn-primary:hover { background: #c39c34; }
.btn-primary:disabled { opacity: .55; cursor: default; }
.gen-status { margin-left: 14px; font-size: 13px; color: var(--gray); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-secondary {
  background: transparent; color: var(--gold-dim); border: 1px solid var(--gold-soft);
  font-weight: 600; font-size: 14px; padding: 11px 18px; border-radius: 8px; cursor: pointer;
}
.btn-secondary:hover { background: #f3eedd; }
.btn-secondary:disabled { opacity: .55; cursor: default; }

.recent, .history { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 12px 16px;
}
.row .meta { display: flex; flex-direction: column; gap: 2px; }
.row .title { font-size: 14px; font-weight: 600; color: var(--ink); }
.row .sub { font-size: 12px; color: var(--gray); }
.row a { font-size: 13px; color: var(--gold); text-decoration: none; font-weight: 600; }
.row a:hover { text-decoration: underline; }
.tag { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold);
  border: 1px solid var(--gold-soft); border-radius: 20px; padding: 2px 9px; }
.empty { color: var(--gray); font-size: 13px; padding: 6px 2px; }
.warn { background: #fbeee0; border: 1px solid #e8c9a0; color: #8a5a1e; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.field-2col { display: flex; gap: 16px; }
.field-2col > div { flex: 1; }
.pv-result { margin-top: 18px; }
.pv-ok { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 10px; padding: 16px 18px; }
.pv-title { font-weight: 600; font-size: 15px; color: var(--ink); margin-bottom: 8px; }
.pv-otp { font-size: 14px; color: var(--ink); background: var(--field-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.pv-otp strong { font-family: 'Courier New', monospace; font-size: 18px; letter-spacing: 3px; color: var(--gold-dim); }
.pv-meta { font-size: 12px; color: var(--gray); }

/* provisioning: multi-card review form */
.card + .card { margin-top: 16px; }
.card-h { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 18px; margin: 0 0 14px; color: var(--dark); }
.field-3col { display: flex; gap: 16px; }
.field-3col > div { flex: 1; }
textarea {
  width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--field-bg); color: var(--ink);
  font-family: inherit; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--gold-soft); background: #fff; }
input[type=number] {
  width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--field-bg); color: var(--ink);
}
input[type=number]:focus { outline: none; border-color: var(--gold-soft); background: #fff; }
input[type=file] { font-size: 13px; color: var(--gray); margin-bottom: 4px; }

/* invoices */
.invoices { display: flex; flex-direction: column; gap: 8px; }
.inv-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.inv-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.inv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-num { font-weight: 500; color: var(--dark); }
.inv-sub { font-size: 12px; color: var(--gray); }
.inv-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.inv-actions a, .inv-actions button { font-size: 12px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--field-bg); color: var(--dark); cursor: pointer; text-decoration: none; }
.inv-actions a:hover, .inv-actions button:hover { border-color: var(--gold-soft); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.4px; }
.badge-draft { background: #ece9e0; color: #7a7363; }
.badge-open { background: #e7f0fb; color: #2f6fb0; }
.badge-paid { background: #e6f4ea; color: #2f8f4e; }
.badge-overdue { background: #fbeaea; color: #c0392b; }
.badge-void { background: #efefef; color: #999; }
.flag { font-size: 11px; color: #c0392b; font-weight: 500; }
.flag-suspend { font-size: 11px; background: #c0392b; color: #fff; padding: 2px 8px; border-radius: 999px; }
.iv-vathint-wrap .hint { margin-top: 6px; }

/* customers (CMS overview) */
.cust-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.cust-stat { background: var(--field-bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; display: flex; align-items: baseline; gap: 6px; }
.cust-stat .n { font-family: "Instrument Serif", Georgia, serif; font-size: 20px; color: var(--dark); }
.cust-stat .l { font-size: 11px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.4px; }
.cust-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.cust-toggle { font-size: 13px; color: var(--gray); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--field-bg); border: 1px solid var(--line); color: var(--gray); text-transform: uppercase; letter-spacing: 0.4px; }
.chip-manual { background: #f3edda; border-color: var(--gold-soft); color: #a68b4b; }

/* customer detail tabs */
.cust-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.cust-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font-size: 14px; color: var(--gray); cursor: pointer; border-radius: 0; }
.cust-tab:hover { color: var(--dark); border-color: transparent; }
.cust-tab.active { color: var(--dark); border-bottom-color: var(--gold); font-weight: 600; }

/* Invoice review overlay */
.rev-overlay { position: fixed; inset: 0; background: rgba(26,26,26,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.rev-overlay[hidden] { display: none; }
.rev-box { background: var(--card); border: 1px solid var(--line); border-radius: 6px; width: min(980px, 100%); height: min(92vh, 1100px); display: flex; flex-direction: column; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.rev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.rev-title { font-size: 1.15rem; color: var(--ink); font-weight: 600; }
.rev-sub { color: var(--gray); font-size: .85rem; margin-top: 2px; }
.rev-x { background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--gray); cursor: pointer; padding: 0 4px; }
.rev-x:hover { color: var(--ink); }
.rev-frame { flex: 1; width: 100%; border: none; background: var(--field-bg); }
.rev-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line); }
.rev-msg { color: var(--gray); font-size: .85rem; }
.rev-msg.err { color: #b3261e; }

/* ---------------------------------------------------------------
   Auth gate
   Note: the base stylesheet only styles input[type=text]; email and
   password inputs are styled here explicitly, or the browser draws
   its own hard-edged boxes.
   --------------------------------------------------------------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(201, 169, 98, .14), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(26, 26, 26, .05), transparent 60%),
    var(--bg);
}
.auth-gate[hidden] { display: none; }

.auth-box {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 42px 38px 34px;
  box-shadow:
    0 1px 2px rgba(26, 26, 26, .04),
    0 8px 24px rgba(26, 26, 26, .06),
    0 24px 60px rgba(26, 26, 26, .08);
}

.auth-mark {
  font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  font-size: 2.4rem; line-height: 1; text-align: center; letter-spacing: .3px;
}
.auth-mark .wm-dark { color: var(--ink); }
.auth-mark .wm-gold { color: var(--gold); }

.auth-sub {
  text-align: center; color: var(--gray);
  font-size: .68rem; letter-spacing: .32em; text-transform: uppercase;
  margin: 10px 0 6px;
}

/* a hairline that fades out at both ends */
.auth-box #auth-form { margin-top: 26px; position: relative; }
.auth-box #auth-form::before {
  content: ''; position: absolute; top: -18px; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.auth-box label {
  display: block; font-size: .72rem; font-weight: 600;
  letter-spacing: .04em; color: var(--gray);
  text-transform: uppercase; margin-bottom: 7px;
}

.auth-box input[type=email],
.auth-box input[type=password] {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.auth-box input[type=email]:focus,
.auth-box input[type=password]:focus {
  outline: none;
  background: #fff;
  border-color: var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(201, 169, 98, .14);
}
.auth-box input::placeholder { color: #b8b3a4; }

.auth-btn {
  width: 100%;
  margin-top: 22px;
  padding: 12px 16px;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; letter-spacing: .02em;
  color: #fff; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  box-shadow: 0 1px 2px rgba(26, 26, 26, .08);
  transition: filter .15s ease, transform .06s ease, box-shadow .15s ease;
}
.auth-btn:hover { filter: brightness(1.04); box-shadow: 0 3px 10px rgba(201, 169, 98, .32); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: .6; cursor: default; filter: none; box-shadow: none; }

.auth-msg {
  margin-top: 14px; min-height: 18px;
  font-size: .8rem; text-align: center; color: #b3261e;
}
.auth-msg.info { color: var(--gray); }

.auth-foot {
  margin-top: 26px; text-align: center;
  font-size: .68rem; color: #b8b3a4; letter-spacing: .06em;
}

/* The signed-in account, in the sidebar footer (dark background) */
.acct { margin-bottom: 12px; }
.acct[hidden] { display: none; }
.acct-who { font-size: 11px; color: var(--gold-soft); margin-bottom: 6px; word-break: break-all; }
.acct-out { background: none; border: 1px solid rgba(255,255,255,.18); border-radius: 5px; padding: 4px 10px; color: #8a8576; cursor: pointer; font-size: 11px; transition: color .15s ease, border-color .15s ease; }
.acct-out:hover { color: #f4f1e8; border-color: var(--gold-dim); }

/* Buttons that must look like the links they replaced (downloads need a token, so they cannot be plain hrefs) */
.linkish { background: none; border: none; padding: 0; margin: 0; font: inherit; color: var(--gold-dim); cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--ink); }

/* Customer number: it prefixes the invoice series (26-0105-001), so it reads as an ID, not a chip. */
.cust-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--gold-dim); background: var(--field-bg); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; margin-right: 8px; }
.cust-no-missing { color: #b3261e; border-color: #e6c3bd; }
.cust-name { text-decoration: underline; text-decoration-color: #e3d6b3; text-underline-offset: 2px; }
