/* Milkyway look and feel, inspired by alldaydtf.com: plum-charcoal text,
   warm off-white pages, bright blue actions, square corners. */
:root {
  --ink: #2E2A39;
  --ink-soft: rgba(46, 42, 57, 0.75);
  --ink-faint: rgba(46, 42, 57, 0.55);
  --page: #FFFEFC;
  --cream: #FAF3E3;
  --line: #E7DFCF;
  --blue: #019AFF;
  --blue-deep: #0189E3;
  --yellow: #FFD37C;
  --magenta: #FF00EF;
  --plum: #5E3653;
  --orange: #E8710A;
  --cyan: #19C7D6;
  --up: #1A7F4B;
  --down: #B4412C;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Anek Tamil', 'Segoe UI', Arial, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.4;
}

h1, h2, h3, .brand, .big {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 34px; }
h2 { font-size: 22px; margin: 32px 0 12px; }
h3 { font-size: 16px; margin-bottom: 12px; }
.plain { font-family: 'Anek Tamil', sans-serif; font-weight: 500; color: var(--ink-soft); font-size: 16px; letter-spacing: 0; }

/* ---------- Top strip and banner ---------- */
.strip {
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 6px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.strip-button {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-size: 12px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 3px 10px;
  cursor: pointer;
}
.strip-button:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
.strip-button:disabled { opacity: 0.6; cursor: default; }

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, #050507 0%, #0D0D12 45%, #16161D 70%, #08080B 100%);
}
.banner > * { position: relative; z-index: 1; }
/* The galaxy: a soft, tilted band of light across the right side. */
.banner::before {
  content: '';
  position: absolute;
  left: 38%;
  right: -10%;
  top: 50%;
  height: 120px;
  transform: translateY(-50%) rotate(-7deg);
  background:
    radial-gradient(ellipse 12% 30% at 52% 50%, rgba(255, 255, 255, 0.5), transparent 100%),
    radial-gradient(ellipse 34% 26% at 50% 50%, rgba(255, 255, 255, 0.22), transparent 100%),
    radial-gradient(ellipse 50% 46% at 50% 50%, rgba(205, 210, 225, 0.16), transparent 100%);
  filter: blur(6px);
}
/* Stars: three sheets of dots in different sizes, so the pattern never lines up. */
.banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 97px 71px, rgba(255, 255, 255, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 143px 18px, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 61px 52px, rgba(255, 255, 255, 0.9) 50%, transparent 51%),
    radial-gradient(1px 1px at 188px 96px, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 229px 11px, rgba(255, 255, 255, 0.45) 50%, transparent 51%),
    radial-gradient(2px 2px at 113px 40px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 271px 83px, rgba(255, 255, 255, 0.55) 50%, transparent 51%);
  background-size: 173px 109px, 173px 109px, 173px 109px, 239px 127px, 239px 127px, 239px 127px, 397px 149px, 397px 149px;
}
.mark { width: 40px; height: 40px; flex: none; }
.mark ellipse { stroke: #C9CCD6; }
.brand { font-size: 26px; line-height: 1.1; }
.tagline { font-size: 14px; opacity: 0.9; }

/* ---------- Page layout ---------- */
.layout { display: flex; min-height: calc(100vh - 110px); }

.sidebar {
  flex: none;
  width: 210px;
  background: var(--cream);
  border-right: 1px solid var(--line);
  padding: 16px 0;
}
.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 20px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border-left: 4px solid transparent;
}
.nav-item.active { background: var(--page); border-left-color: var(--blue); }
.nav-item.soon { color: var(--ink-faint); font-weight: 500; }
.nav-item small { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; }

main { flex: 1; min-width: 0; padding: 24px 28px 48px; max-width: 1280px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-soft); }
#custom-dates { display: flex; gap: 12px; }
#custom-dates[hidden] { display: none; }
select, input[type="date"] {
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 7px 10px;
  min-height: 38px;
}
select:focus-visible, input:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.notice { margin-top: 16px; padding: 10px 14px; background: var(--cream); border-left: 4px solid var(--yellow); font-size: 15px; }
.notice.problem { border-left-color: var(--down); }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card, .panel, .tile { background: #fff; border: 1px solid var(--line); }
.card { padding: 16px; border-top: 4px solid var(--blue); }
.card:nth-child(2) { border-top-color: var(--magenta); }
.card:nth-child(3) { border-top-color: var(--orange); }
.card:nth-child(4) { border-top-color: var(--cyan); }
.label { font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-soft); }
.big { font-size: 28px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sub { font-size: 14px; color: var(--ink-soft); }
.versus { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 4px; }
.versus div { color: var(--ink-soft); }
.delta { font-weight: 700; white-space: nowrap; color: var(--ink); }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 14px 16px; }
.tile .big { font-size: 22px; }
/* Each column is as wide as its number; the numbers shrink a little in narrow boxes so they never touch. */
.tile { container-type: inline-size; }
.split { display: grid; grid-auto-columns: auto; grid-auto-flow: column; justify-content: space-between; gap: 8px; margin: 8px 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.split > div + div { border-left: 1px solid var(--line); padding-left: 8px; }
.split-name { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.split-value { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-weight: 800; font-size: min(15px, 4.8cqw); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Three stores side by side need room: two tiles per row until the screen is wide. */
.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.panel { padding: 16px; margin-top: 16px; }
.two-up { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-box { position: relative; height: 300px; }

details { margin-top: 12px; font-size: 14px; }
summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 12px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
tr.aside td { color: var(--ink-soft); }
.empty { color: var(--ink-soft); padding: 8px 0; }

/* ---------- Login ---------- */
main.login { max-width: 420px; margin: 40px auto; padding: 0 16px; }
.login-fields { grid-template-columns: minmax(0, 1fr); }
input[type="password"] { font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); background: #fff; border: 1px solid var(--ink); border-radius: 0; padding: 7px 10px; min-height: 38px; width: 100%; }
.who { opacity: 0.85; }
body.role-user .admin-only { display: none !important; }
body:not(.role-user) .user-only { display: none; }

/* ---------- Forms ---------- */
.lead { color: var(--ink-soft); max-width: 70ch; margin: 8px 0 0; }
/* Boxes line up along the bottom, even when one label has an extra hint line. */
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; align-items: end; }
.fields label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-soft); }
.fields label.wide { grid-column: 1 / -1; }
.hint { font-weight: 500; text-transform: none; letter-spacing: 0; }
input[type="text"] { font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); background: #fff; border: 1px solid var(--ink); border-radius: 0; padding: 7px 10px; min-height: 38px; width: 100%; }
input[type="date"] { width: 100%; }
.button {
  font: inherit; font-weight: 700; font-size: 14px; letter-spacing: 0.6px; text-transform: uppercase;
  color: #fff; background: var(--blue); border: 1px solid var(--blue); border-radius: 0; padding: 9px 18px; cursor: pointer;
}
.button:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.button.outline { color: var(--ink); background: transparent; border-color: var(--ink); }
.button.outline:hover { color: #fff; background: var(--ink); }
.button.small { font-size: 12px; padding: 4px 10px; }
#undo .button { margin-left: 8px; }
.hint-line { font-size: 14px; color: var(--ink-soft); margin: 10px 0 0; }
td.actions { white-space: nowrap; }
td.actions .button + .button { margin-left: 6px; }
td select { min-height: 32px; padding: 3px 8px; font-size: 14px; }
.button.danger { color: #fff; background: var(--down); border-color: var(--down); }
#reset .button + .button { margin-left: 6px; }
@media (max-width: 760px) { .fields { grid-template-columns: minmax(0, 1fr); } }

.footnote { margin-top: 28px; font-size: 14px; color: var(--ink-soft); max-width: 70ch; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1050px) {
  .cards, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-up { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { flex: none; gap: 6px; padding: 10px 14px; border-left: 0; border-bottom: 4px solid transparent; }
  .nav-item.active { border-bottom-color: var(--blue); }
  main { padding: 16px 16px 40px; }
  h1 { font-size: 28px; }
  .two-up { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .split { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
  .split > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .chart-box { height: 240px; }
}
@media (max-width: 460px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .big { font-size: 24px; }
}
