
:root {
  color-scheme: light;
  --ink: #1f2428;
  --muted: #65717a;
  --line: #d9e0e4;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --coffee: #74523a;
  --milk: #1e7c86;
  --good: #16784a;
  --bad: #b7382f;
  --accent: #ffb347;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #fff2cf 0, transparent 28rem), linear-gradient(135deg, #f8f5ee, #eef7f6);
  color: var(--ink);
  min-height: 100vh;
}
a { color: #176977; }
.topnav {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 clamp(18px, 4vw, 46px);
  border-bottom: 1px solid rgba(31,36,40,.1);
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 850; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.menu-toggle {
  width: 46px;
  height: 42px;
  display: inline-grid;
  place-content: center;
  gap: 5px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 26px rgba(31,36,40,.08);
  cursor: pointer;
}
.menu-toggle span {
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
  transition: transform .16s ease, opacity .16s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.navlinks {
  position: absolute;
  top: calc(100% + 8px);
  left: clamp(18px, 4vw, 46px);
  min-width: 210px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(31,36,40,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 22px 52px rgba(31,36,40,.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.topnav.menu-open .navlinks {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.navlinks a, .button {
  text-decoration: none;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.navlinks a.on, .navlinks a:hover, .button.ghost, button.ghost { border-color: var(--line); background: rgba(255,255,255,.7); }
.shell { width: min(1180px, calc(100% - 28px)); margin: 28px auto 64px; }
.site-footer {
  width: min(1180px, calc(100% - 28px));
  margin: -34px auto 32px;
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: .9rem;
}
.site-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 750;
}
.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.login { min-height: 100vh; display: grid; place-items: center; padding: clamp(14px, 4vw, 28px); }
.login-card, .panel {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(31,36,40,.1);
  box-shadow: 0 18px 55px rgba(31,36,40,.08);
  border-radius: 8px;
}
.login-card {
  width: min(980px, calc(100% - 48px));
  min-height: 520px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr);
  overflow: hidden;
}
.login-brand {
  padding: clamp(34px, 5vw, 54px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  background: linear-gradient(150deg, #17372f, #1d6d64);
  color: #fff;
}
.login-brand-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 3vw, 18px);
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}
.login-brand-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.login-brand h1 {
  color: #fff;
  font-size: clamp(2.25rem, 3.15vw, 3.25rem);
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}
.login-brand p {
  color: rgba(255,255,255,.72);
  font-size: clamp(.92rem, 1.8vw, 1.05rem);
  line-height: 1.25;
  margin: 0;
  max-width: 25rem;
  font-weight: 600;
}
.login-form-panel {
  padding: clamp(26px, 5vw, 46px);
  display: grid;
  align-content: center;
}
.login-form-panel form {
  width: 100%;
}
.remember-check {
  justify-content: flex-start;
  gap: 10px;
  margin: 2px 0 4px;
  font-weight: 800;
  color: var(--ink);
}
.cup { width: 56px; height: 56px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #ffe1a6; color: var(--ink); font-size: 1.9rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 4.8rem); line-height: .95; letter-spacing: 0; margin-bottom: 12px; }
.home-title { text-align: center; }
h2 { font-size: 1.15rem; margin-bottom: 16px; }
.eyebrow { text-transform: uppercase; font-size: .76rem; font-weight: 800; color: var(--muted); letter-spacing: .08em; }
.hint, .empty { color: var(--muted); font-size: .9rem; }
.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid #efaaa4; background: #fff0ef; color: var(--bad); }
.notice { padding: 10px 12px; border-radius: 8px; border: 1px solid #a8d9bd; background: #edf9f1; color: var(--good); }
.account-meta {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}
.account-meta div {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.account-meta dt {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.account-meta dd {
  margin: 0;
  font-weight: 800;
}
.hero, .admin-head {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 420px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}
.balance, .kpis {
  background: #20302d;
  color: #fff;
  border-radius: 8px;
  padding: 24px;
  display: grid;
  align-content: center;
  min-height: 170px;
}
.balance span, .kpis span { color: rgba(255,255,255,.72); font-weight: 700; }
.balance strong { font-size: clamp(2.3rem, 5vw, 4.5rem); letter-spacing: 0; }
.balance.good { background: linear-gradient(135deg, #214238, #16784a); }
.balance.bad { background: linear-gradient(135deg, #4a2725, #b7382f); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.drink {
  width: 100%;
  min-height: 220px;
  border: 0;
  border-radius: 8px;
  padding: 26px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  display: grid;
  align-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.drink:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(31,36,40,.16); }
.drink span { font-size: 2.2rem; }
.drink strong { font-size: clamp(2rem, 5vw, 4rem); letter-spacing: 0; }
.drink em { font-style: normal; font-size: 1.1rem; font-weight: 800; }
.drink small { font-size: .9rem; font-weight: 650; margin-top: 10px; }
.cash-info { background: linear-gradient(135deg, #214238, #16784a); color: #fff; }
.cash-info h2 { margin: 0 0 12px; color: #fff; }
.cash-info > strong { font-size: clamp(2rem, 5vw, 3rem); }
.cash-info p { margin: 8px 0 0; color: rgba(255,255,255,.82); }
.journal-info { margin-top: 18px; background: linear-gradient(135deg, #51426c, #342749); }
.journal-refresh { margin-top: 16px; background: #fff; color: #342749; }
.drink.coffee { background: linear-gradient(135deg, #8a603e, #38251b); }
.drink.milk { background: linear-gradient(135deg, #2792a0, #164e58); }
.pay-section { margin-bottom: 18px; }
.pay-panel {
  background: linear-gradient(135deg, #0d7cc9, #143f73);
  color: #fff;
  min-height: 220px;
  display: grid;
  align-content: space-between;
  gap: 14px;
}
.pay-panel h2 {
  color: #fff;
  font-size: clamp(1.75rem, 4vw, 3.3rem);
  line-height: 1;
  margin: 0;
}
.pay-panel p {
  color: rgba(255,255,255,.82);
  margin: 0;
  font-weight: 650;
}
.pay-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: #0d7cc9;
  font-size: 1.7rem;
  font-weight: 950;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.pay-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.pay-form label {
  color: rgba(255,255,255,.86);
}
.pay-form input {
  border-color: rgba(255,255,255,.45);
  background: rgba(255,255,255,.92);
  color: var(--ink);
}
.pay-button {
  background: #fff;
  border-color: #fff;
  color: #143f73;
  min-width: 190px;
}
.pay-button:hover {
  background: #eef7ff;
  border-color: #eef7ff;
}
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel { padding: 22px; overflow: hidden; }
.admin-panel {
  border: 1px solid rgba(32,48,45,.08);
  box-shadow: 0 18px 45px rgba(31,36,40,.08);
}
.accounts-panel {
  background: linear-gradient(135deg, #dcedff, #c8e0f6);
}
.accounts-panel .tablewrap {
  max-height: min(48vh, 460px);
  overflow: auto;
}
.accounts-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #dcedff;
}
.payment-panel {
  background: linear-gradient(135deg, #e7f6ed, #cfeada);
}
.pending-panel {
  background: linear-gradient(135deg, #fff6d7, #f9dfaa);
}
.expense-panel {
  background: linear-gradient(135deg, #fff0df, #f6d9bc);
}
.legal-edit-panel {
  background: linear-gradient(135deg, #f4f7fb, #e7edf4);
}
.admin-panel h2 {
  color: #1d3446;
}
.admin-panel th {
  color: rgba(29,52,70,.72);
}
.admin-panel td,
.admin-panel th {
  border-bottom-color: rgba(29,52,70,.18);
}
.admin-panel label {
  color: rgba(29,52,70,.78);
}
.admin-panel input,
.admin-panel select {
  background: rgba(255,255,255,.86);
  border-color: rgba(29,52,70,.2);
}
.panel.narrow { max-width: 680px; }
.panel-title { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 14px; }
.panel-title .button { display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.db-status {
  margin: -4px 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(29,52,70,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.62);
  color: var(--muted);
  font-size: .9rem;
}
.db-status strong { color: var(--ink); }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; width: 100%; }
.admin-actions .button { display: inline-flex; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.stack { display: grid; gap: 12px; }
.inline-form, .user-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.user-form { padding: 14px; border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; margin-bottom: 20px; }
.create-user-box {
  margin: 0 0 18px;
}
.create-user-box summary {
  list-style: none;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.create-user-box summary::-webkit-details-marker {
  display: none;
}
.user-list-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.user-list-tools label {
  flex: 1 1 280px;
  max-width: 520px;
}
.button.small {
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: .84rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.user-list-wrap {
  max-height: min(58vh, 620px);
  overflow: auto;
}
.user-list-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}
.register-box {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.register-box summary {
  cursor: pointer;
  font-weight: 850;
  margin-bottom: 12px;
}
.opening-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
}
label { display: grid; gap: 6px; font-size: .88rem; font-weight: 750; color: var(--muted); }
label.check { display: flex; align-items: center; min-height: 42px; }
.month-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.month-picker summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  font-weight: 850;
  cursor: pointer;
}
.month-list {
  max-height: 260px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 6px 11px;
}
.month-list label.check {
  min-height: 34px;
  color: var(--ink);
}
.month-list label.check[hidden] {
  display: none;
}
input, select {
  height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea {
  min-height: 170px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
button, .button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
}
button.primary, .button.primary {
  border-color: #1f2428;
  background: #1f2428;
  color: #fff;
}
button.danger {
  border-color: #b7382f;
  background: #b7382f;
  color: #fff;
}
button.success {
  border-color: var(--good);
  background: var(--good);
  color: #fff;
}
button.wide { width: 100%; }
button.small { height: 32px; padding: 0 10px; font-size: .84rem; }
button.save-button {
  background: var(--good);
  border-color: var(--good);
  color: #fff;
}
button.save-button:hover { filter: brightness(.95); }
.tablewrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.history-table th:nth-child(1),
.history-table td:nth-child(1) {
  width: 112px;
  white-space: nowrap;
}
.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 120px;
  white-space: nowrap;
  font-weight: 750;
}
.history-table td:nth-child(2) {
  font-weight: 650;
}
.pos { color: var(--good); }
.neg { color: var(--bad); }
.kpis { grid-template-columns: repeat(3, 1fr); gap: 14px; min-height: auto; }
.kpis div { display: grid; gap: 5px; }
.kpis strong { font-size: 1.35rem; }
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.action-buttons form {
  margin: 0;
}
.badge {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1d3446;
  color: #fff;
  font-weight: 850;
}
.match-list {
  margin: 0;
  padding-left: 18px;
}
.muted {
  color: var(--muted);
}
.legal-content {
  color: var(--ink);
  line-height: 1.55;
}
.legal-content p {
  margin: 0;
}
.mini-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
  min-width: min(760px, 92vw);
}
.mini-form label {
  font-size: .78rem;
  gap: 4px;
}
.mini-form label.flat-period {
  grid-column: 1 / -1;
}
.mini-form .flat-status {
  grid-column: 1 / -1;
  margin: 2px 0 4px;
  color: var(--muted);
  font-size: .86rem;
}
.mini-form label.option-check {
  justify-content: flex-start;
  gap: 8px;
  color: var(--ink);
}
.mini-form label.option-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}
.mini-form input,
.mini-form select {
  height: 34px;
  font-size: .86rem;
}
.mini-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}
.mini-form button {
  height: 34px;
}
.history-note-form {
  min-width: 0;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}
.history-note-form h4 {
  margin: 0;
  font-size: 1rem;
}
.history-note-form textarea {
  min-height: 88px;
}
.history-note-form button {
  justify-self: start;
}
.delete-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.delete-form h4 {
  margin: 0 0 4px;
}
.delete-form p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}
dialog { border: 0; border-radius: 8px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(31,36,40,.42); }
.modal { padding: 24px; width: min(420px, calc(100vw - 32px)); }
.admin-modal {
  width: min(860px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h3 { margin: 0; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 16px;
  background: #b7382f;
  color: #fff;
  font-weight: 850;
  text-align: center;
}
.offline-panel {
  text-align: center;
}
@media (max-width: 780px) {
  .topnav { height: 58px; min-height: 58px; padding: 0 12px; }
  .navlinks { left: 12px; right: 12px; min-width: 0; }
  .login {
    min-height: 100svh;
    align-items: start;
    padding: 12px;
  }
  .login-card {
    width: 100%;
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .login-brand {
    padding: 24px;
    min-height: 176px;
  }
  .login-brand h1 {
    font-size: clamp(1.85rem, 8vw, 2.7rem);
    white-space: normal;
  }
  .login-brand-copy {
    text-align: left;
  }
  .login-form-panel {
    padding: 24px;
    align-content: start;
  }
  .hero, .admin-head, .split, .quick-grid { grid-template-columns: 1fr; }
  .drink { min-height: 160px; }
  .pay-panel { min-height: 190px; }
  .pay-form { grid-template-columns: 1fr; }
  .pay-button { width: 100%; min-width: 0; }
  .kpis { grid-template-columns: 1fr; }
  .shell { width: min(100% - 20px, 1180px); margin-top: 16px; }
  .history-table { min-width: 0; }
  .history-table th,
  .history-table td { padding: 9px 6px; }
  .history-table th:nth-child(1),
  .history-table td:nth-child(1) { width: 92px; }
  .history-table th:nth-child(3),
  .history-table td:nth-child(3) { width: 96px; }
  .mini-form { grid-template-columns: 1fr; min-width: 280px; }
  .delete-form { align-items: stretch; flex-direction: column; }
}
@media (max-width: 430px) {
  .login { padding: 0; }
  .login-card {
    width: 100%;
    min-height: 100svh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .login-brand,
  .login-form-panel {
    padding: 22px 18px;
  }
  .login-brand-title {
    gap: 10px;
  }
  .login-brand h1 {
    font-size: clamp(1.65rem, 8vw, 2.1rem);
  }
  .cup {
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
  }
  .register-box {
    margin-top: 14px;
    padding-top: 12px;
  }
}
