:root {
  /* Mint & sky pastel theme */
  --navy: #085041;        /* deep teal: headings, dark accents */
  --navy-2: #0f6e56;
  --coral: #9fe1cb;       /* mint: primary buttons, active items */
  --mint-50: #ddf3ec;
  --mint-100: #c8ebdd;
  --mint: #9fe1cb;
  --mint-hover: #86d6ba;
  --mint-ink: #04342c;
  --sky: #b5d4f4;
  --sky-hover: #9cc4ee;
  --sky-ink: #0c447c;
  --green: #1f9d6b;
  --amber: #c98a06;
  --red: #d64545;
  --blue: #185fa5;
  --bg: #f5fbf9;
  --card: #ffffff;
  --text: #1d2033;
  --muted: #6b7088;
  --line: #dcebe5;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
small { display: block; color: var(--muted); font-size: 12px; }

/* layout */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--mint-50); color: var(--navy); border-right: 1px solid var(--mint-100); display: flex; flex-direction: column; z-index: 30; transition: transform .2s; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(8,80,65,.12); }
.brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; font-weight: 700; font-size: 20px; }
.brand strong { color: var(--mint-ink); display: block; font-size: 14px; }
.brand small { color: #2f5f53; }
.sidebar nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; color: var(--navy); padding: 9px 12px; border-radius: 8px; margin-bottom: 2px; }
.sidebar nav a:hover { background: var(--mint-100); text-decoration: none; }
.sidebar nav a.active { background: var(--mint); color: var(--mint-ink); font-weight: 600; }
.sidebar .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(8,80,65,.12); font-size: 12px; }
.sidebar-foot strong { color: var(--mint-ink); }
.sidebar-foot small { color: #2f5f53; margin-bottom: 6px; }
.sidebar-foot a { color: var(--sky-ink); }
.main { margin-left: 248px; min-height: 100vh; display: flex; flex-direction: column; }
.main.guest { margin-left: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 19px; margin: 0; flex: 1; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; font-size: 20px; cursor: pointer; }
.content { padding: 20px 24px; flex: 1; }
.foot { padding: 14px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  #navtoggle:checked ~ .sidebar { transform: none; }
  #navtoggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}

/* components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.accent { border-top: 3px solid var(--sky); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.btn:hover { text-decoration: none; background: #f7f8fc; }
.btn-primary { background: var(--mint); border-color: var(--mint); color: var(--mint-ink); }
.btn-primary:hover { background: var(--mint-hover); border-color: var(--mint-hover); }
.btn-coral { background: var(--sky); border-color: var(--sky); color: var(--sky-ink); }
.btn-coral:hover { background: var(--sky-hover); border-color: var(--sky-hover); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfe; font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; background: #fafbfe; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-green { background: #e3f6ee; color: #137a52; }
.badge-amber { background: #fdf3dc; color: #8a5d00; }
.badge-red { background: #fde6e6; color: #b42f2f; }
.badge-blue { background: #e4edfd; color: #1f55b3; }
.badge-gray { background: #eceef4; color: #555a70; }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: #e8f8f0; border-color: #b7e6cf; color: #13643f; }
.alert-error { background: #fdeceb; border-color: #f4c2bf; color: #a12a24; }
.alert-info { background: #eaf1fe; border-color: #c4d7fb; color: #1d4a99; }
.alert-warn { background: #fdf5e1; border-color: #f1dca3; color: #7a5300; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

form .field { margin-bottom: 12px; }
label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd3e2; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47,111,219,.25); border-color: var(--blue); }
textarea { min-height: 70px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 3px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 140px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; }

dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 6px; } }

.pager { display: flex; gap: 4px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pager a, .pager span.current { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager span.current { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--mint-50), #e6f1fb); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(8,80,65,.15); }
.login-card .brand-mark { margin-bottom: 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs a.active { border-color: #1d9e75; color: var(--text); font-weight: 600; }
.chart-box { position: relative; height: 280px; }
.cols-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }

/* print */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .foot, .no-print, .scrim { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { border: none; padding: 0; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12px; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.doc { max-width: 820px; margin: 0 auto; background: #fff; padding: 28px; border: 1px solid var(--line); border-radius: 8px; }
.doc-head { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 14px; }
.doc-head img { height: 54px; }
.doc h2 { text-align: center; text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 14px; }
.sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.sig div { border-top: 1px solid #000; padding-top: 4px; text-align: center; font-size: 12px; }
a.kpi { color: inherit; }
a.kpi:hover { text-decoration: none; border-color: #5dcaa5; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #3b7a69; padding: 12px 12px 4px; }

.nav-group > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: '▾'; opacity: .6; }
.nav-group:not([open]) > summary::after { content: '▸'; }
.topsearch input { width: 260px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: #f5fbf9; }
@media (max-width: 700px) { .topsearch input { width: 140px; } }
.env-banner { background: #f2b705; color: #1d2033; text-align: center; font-weight: 700; padding: 4px; font-size: 12px; position: sticky; top: 0; z-index: 50; letter-spacing: .05em; }
.todo { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; color: inherit; }
.todo:hover { border-color: #5dcaa5; text-decoration: none; }
.todo .n { font-size: 20px; font-weight: 700; }
/* Customizable dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-head select { padding: 6px 8px; }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash > .dash-w { margin: 0; min-width: 0; }
.dash > .w-full { grid-column: 1 / -1; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.dash-picker { list-style: none; margin: 10px 0 0; padding: 0; }
.dash-picker li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card); }
.dash-picker li.off { opacity: .55; }
.dash-picker label span small { display: block; color: var(--muted); font-weight: 400; }
.dash-picker .mv { display: flex; gap: 4px; }
.dash-picker select { width: auto; }
.verify-box { display: flex; gap: 14px; align-items: center; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 18px; font-size: 12px; }
.verify-box #qr img, .verify-box #qr canvas { width: 96px; height: 96px; }
.print-only { display: none; }
@media print { .print-only { display: table-cell; } p.print-only { display: block; } }
