/* C&B IVT Portal — brand: Sunrise Amber, Golden Hour, Starry White, Cloudy Grey, Midnight Ash */
:root {
  --amber: #f2ac3c;
  --amber-dark: #d99325;
  --gold: #f8d65a;
  --white: #faf8f3;
  --grey: #646767;
  --ash: #111111;
  --line: #e6e2d8;
  --card: #ffffff;
  --muted: #8a8c8c;
  --ok: #2e8b57;
  --ok-bg: #e7f4ec;
  --part: #b7791f;
  --part-bg: #fdf3dc;
  --bad: #c0392b;
  --bad-bg: #fbe9e7;
  --nt: #5b6b8c;
  --nt-bg: #eceff6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17,17,17,.06), 0 2px 8px rgba(17,17,17,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "General Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--ash);
  background: var(--white);
  line-height: 1.45;
}
h1, h2, h3, h4 { font-family: "Urbanist", "General Sans", sans-serif; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
a { color: var(--amber-dark); }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ash);
  padding: 8px 14px; border-radius: 8px; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
button:hover { border-color: var(--grey); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--ash); font-weight: 600; }
.btn-primary:hover { background: var(--amber-dark); border-color: var(--amber-dark); }
.btn-dark { background: var(--ash); border-color: var(--ash); color: #fff; }
.btn-danger { color: var(--bad); border-color: #f0c9c4; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ash);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--amber); }
input[type=checkbox] { width: auto; accent-color: var(--amber-dark); }
textarea { resize: vertical; min-height: 60px; }
label { display: block; font-weight: 500; font-size: 13px; margin: 10px 0 4px; color: var(--grey); }
.req::after { content: " *"; color: var(--bad); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ash); font-size: 14px; margin: 6px 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span { background: var(--white); border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; padding: 9px 10px; color: var(--grey); }
.prefix-input input { border-radius: 0 8px 8px 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: #fff; width: 100%; max-width: 380px; border-radius: 14px; box-shadow: var(--shadow); padding: 28px; border-top: 5px solid var(--amber); }
.login-card img { height: 44px; display: block; margin: 0 auto 10px; }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card p.sub { text-align: center; margin: 4px 0 14px; color: var(--grey); }
.login-card button { width: 100%; margin-top: 16px; padding: 11px; }
.form-error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 3px solid var(--amber);
  display: flex; align-items: center; gap: 12px; padding: 8px 18px;
}
.topbar img { height: 34px; }
.topbar .app-name { font-family: Urbanist, sans-serif; font-weight: 700; font-size: 17px; border-left: 1px solid var(--line); padding-left: 12px; }
.topbar .client-chip { background: var(--gold); padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.user-btn { border: 0; background: transparent; text-align: right; padding: 4px 6px; flex-direction: column; align-items: flex-end; gap: 0; }
.user-btn b { font-weight: 600; font-size: 14px; }
.user-btn small { color: var(--muted); font-size: 12px; }
.menu { position: absolute; right: 14px; top: 56px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 30; }
.menu button { width: 100%; justify-content: flex-start; border: 0; }
.menu button:hover { background: var(--white); }

.tabs { display: flex; gap: 4px; padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 11px 14px; text-decoration: none; color: var(--grey); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--ash); border-bottom-color: var(--amber); font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--grey); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; background: #fcfbf7; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.group td { background: var(--white); font-family: Urbanist, sans-serif; font-weight: 700; color: var(--ash); }
tr.inactive td { color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }

/* ---------- Pills ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.full { background: var(--ok-bg); color: var(--ok); }
.pill.partial { background: var(--part-bg); color: var(--part); }
.pill.non { background: var(--bad-bg); color: var(--bad); }
.pill.nt { background: var(--nt-bg); color: var(--nt); }
.pill.grey { background: #eeeeec; color: var(--grey); }
.pill.amber { background: var(--gold); color: var(--ash); }

/* ---------- Today ---------- */
.today-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress { height: 8px; background: #eee9dc; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; background: var(--amber); width: 0; transition: width .3s; }
.banner { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.banner.closed { background: var(--nt-bg); color: var(--nt); }
.banner.done { background: var(--ok-bg); color: var(--ok); }
.module-title { margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.module-title .count { font-size: 13px; color: var(--muted); font-weight: 500; font-family: "General Sans", sans-serif; }
.point { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; border-left: 4px solid var(--line); }
.point.saved { border-left-color: var(--ok); }
.point.dirty { border-left-color: var(--amber); }
.point .p-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.point .p-title { font-weight: 600; }
.point .p-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.point .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.point .p-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.photo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.photo-row img { height: 64px; width: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.done-list { font-size: 14px; }
.done-list li { margin: 4px 0; }
.submit-bar { position: sticky; bottom: 0; background: rgba(250,248,243,.96); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(17,17,17,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.wide { max-width: 980px; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 4px 18px 16px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.err-list { max-height: 220px; overflow: auto; background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.copy-box { background: var(--white); border: 1px dashed var(--amber); border-radius: 8px; padding: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; margin-top: 8px; word-break: break-all; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); }
.toast { background: var(--ash); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; }
.toast.err { background: var(--bad); }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .topbar img { height: 28px; }
  .topbar .app-name { display: none; }
  main { padding: 12px; }
  .point .grid2 { grid-template-columns: 1fr; }
  .tabs { padding: 0 8px; }
}
