/* ===========================================================================
   Campus Xerox — shared design system (official / institutional look).
   No external fonts or runtime frameworks: loads instantly, fully cacheable.
   Used by index.html (student) and shopkeeper.html (counter).
   =========================================================================== */

:root {
  --navy:        #0d2747;
  --navy-700:    #143a64;
  --navy-600:    #1b4d85;
  --blue:        #1d4ed8;
  --blue-600:    #2563eb;
  --blue-700:    #1e40af;
  --sky:         #e8f0fe;
  --bg:          #eef1f6;
  --bg-2:        #e4e9f1;
  --card:        #ffffff;
  --line:        #d8e0ea;
  --line-2:      #c4cfdd;
  --ink:         #11203a;
  --ink-2:       #33425c;
  --muted:       #687891;
  --green:       #15803d;
  --green-600:   #16a34a;
  --green-50:    #ecfdf3;
  --amber:       #b45309;
  --amber-50:    #fff7ed;
  --red:         #b91c1c;
  --red-50:      #fef2f2;
  --gold:        #c9a227;
  --radius:      12px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 2px rgba(13,39,71,.06), 0 1px 3px rgba(13,39,71,.08);
  --shadow:      0 2px 6px rgba(13,39,71,.08), 0 12px 28px rgba(13,39,71,.08);
  --shadow-lg:   0 10px 40px rgba(13,39,71,.18);
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:        ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 720px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 12px; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr 1fr; } }

/* ---------- Top bar (official header) ---------- */
.topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-600) 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--shadow-sm);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .crest {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  display: grid; place-items: center; font-size: 22px;
}
.brand h1 { font-size: 19px; font-weight: 800; letter-spacing: .2px; margin: 0; line-height: 1.1; }
.brand .sub { font-size: 12px; color: rgba(255,255,255,.72); font-weight: 500; letter-spacing: .3px; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head .title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0; }
.card-head .desc { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.card-body { padding: 22px; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font-weight: 700; font-size: 14px; line-height: 1; border-radius: 10px;
  padding: 12px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, box-shadow .15s, transform .05s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-success { background: var(--green-600); color: #fff; box-shadow: 0 2px 8px rgba(22,163,74,.25); }
.btn-success:hover:not(:disabled) { background: var(--green); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-onnavy { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.28); }
.btn-onnavy:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.btn-lg { padding: 16px 22px; font-size: 16px; border-radius: 12px; }
.btn-xl { padding: 20px 24px; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 8px; }

/* ---------- Form fields ---------- */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.req { color: var(--red); }
.input, .select {
  width: 100%; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 11px 13px; font-size: 15px; color: var(--ink); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23687891' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 38px; }
.input:focus, .select:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.badge-green { background: var(--green-50); color: var(--green); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-red   { background: var(--red-50); color: var(--red); }
.badge-blue  { background: var(--sky); color: var(--blue-700); }
.badge-gray  { background: #eef1f6; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; font-weight: 600; border: 1px solid transparent; }
.alert-error { background: var(--red-50); color: var(--red); border-color: #f3c9c9; }
.alert-ok { background: var(--green-50); color: var(--green); border-color: #bfe6cd; }
.alert-info { background: var(--sky); color: var(--blue-700); border-color: #c5d9fb; }

/* ---------- Money / total banner ---------- */
.total-banner { background: linear-gradient(120deg, var(--green-600), var(--green)); color: #fff; border-radius: 14px; padding: 18px 22px; box-shadow: 0 8px 22px rgba(22,163,74,.22); }
.total-banner .label { font-size: 12px; font-weight: 800; letter-spacing: .26em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.total-banner .amount { font-family: var(--mono); font-size: 52px; font-weight: 800; line-height: 1; }

/* ---------- Ribbon ---------- */
.ribbon { padding: 9px 22px; text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ribbon-green { background: #16a34a; color: #ecfdf3; }
.ribbon-amber { background: #f59e0b; color: #422006; }

/* ---------- File rows (document list) ---------- */
.file-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.file-row + .file-row { margin-top: 10px; }
.file-ic { width: 40px; height: 40px; flex: none; border-radius: 9px; background: var(--sky); color: var(--blue-700); display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.file-main { min-width: 0; flex: 1; }
.file-name { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.file-actions { display: flex; gap: 8px; flex: none; }
.link { color: var(--blue-700); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Spec tiles ---------- */
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.tile .k { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tile .v { font-size: 18px; font-weight: 800; color: var(--ink); margin-top: 3px; }

/* ---------- Progress + timer ---------- */
.token-hero { text-align: center; padding: 8px 0 4px; }
.token-hero .cap { font-size: 12px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.token-hero .num { font-family: var(--mono); font-size: 76px; font-weight: 800; color: var(--blue-700); line-height: 1; letter-spacing: .04em; }
.timer-chip { font-family: var(--mono); font-weight: 800; font-size: 12px; color: var(--blue-700); background: var(--sky); padding: 3px 9px; border-radius: 7px; }
.progress { height: 10px; width: 100%; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress > .bar { height: 100%; background: linear-gradient(90deg, var(--blue-600), var(--blue)); border-radius: 999px; width: 0; transition: width .35s ease; position: relative; overflow: hidden; }
.progress > .bar::after { content: ""; position: absolute; inset: 0; width: 30%; background: rgba(255,255,255,.35); animation: sheen 1.1s ease-in-out infinite; }
@keyframes sheen { 0% { transform: translateX(-120%); } 100% { transform: translateX(420%); } }
.steps { list-style: none; padding: 0; margin: 14px 0 0; }
.steps li { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); padding: 3px 0; }
.steps li .ic { width: 18px; text-align: center; }
.steps li.active { color: var(--blue-700); font-weight: 700; }
.steps li.done { color: var(--green); }
.steps li.err { color: var(--red); font-weight: 700; }

/* ---------- Numpad (shopkeeper) ---------- */
.token-display { height: 104px; border-radius: 14px; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-size: 64px; font-weight: 800; letter-spacing: .22em; border: 2px solid var(--navy-700); }
.token-display.empty { color: rgba(255,255,255,.35); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { padding: 20px 0; font-size: 26px; font-weight: 800; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; transition: background .12s, transform .05s; }
.key:hover { background: var(--bg); }
.key:active { transform: scale(.96); }
.key-danger { background: var(--red-50); border-color: #f3c9c9; color: var(--red); font-size: 16px; }
.key-warn { background: var(--amber-50); border-color: #f6dcb6; color: var(--amber); }

/* ---------- Table ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table thead th { position: sticky; top: 0; background: var(--navy); color: #fff; text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 11px 14px; }
table.table tbody td { padding: 11px 14px; border-top: 1px solid var(--line); color: var(--ink-2); }
table.table tbody tr { cursor: pointer; }
table.table tbody tr:hover { background: var(--sky); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(13,39,71,.55); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.modal-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .15s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- States ---------- */
.state { min-height: 380px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 30px; }
.state-idle { border: 2px dashed var(--line-2); color: var(--muted); }
.state-busy { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink-2); }
.state-error { background: var(--red-50); border: 2px solid #f3c9c9; color: var(--red); }
.spinner { width: 44px; height: 44px; border: 4px solid var(--line-2); border-top-color: var(--blue-600); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 28px 0; }
.hidden { display: none !important; }
