:root{
  --paper: #14130F;
  --surface: #1D1C16;
  --paper-line: #322F26;
  --ink: #F1EDE2;
  --ink-soft: #9C9789;
  --accent: #4FB683;
  --accent-soft: #1C2C22;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}

body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
  line-height:1.5;
  overflow-x:hidden;
}

a{color:inherit;}

/* ---------- header ---------- */
header{
  position:sticky;
  top:0;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 32px;
  background:rgba(20,19,15,0.85);
  backdrop-filter:blur(6px);
  border-bottom:1px solid var(--paper-line);
}

/* Flex items default to min-width:auto, which stops them shrinking below
   their content's natural width — with long labels (e.g. Russian "Кабинет",
   "Выйти") that pushes .nav-actions past the viewport instead of wrapping.
   min-width:0 lets flex-wrap actually kick in. */
header > *{
  min-width:0;
}

.logo{
  display:flex;
  align-items:center;
  gap:10px;
  font-family:var(--mono);
  font-weight:700;
  font-size:18px;
  letter-spacing:-0.02em;
}

.logo .dot{
  width:10px;height:10px;border-radius:2px;
  background:var(--accent);
}

.nav-actions{
  display:flex;
  gap:10px;
}

.btn{
  display:inline-block;
  font-family:var(--sans);
  font-size:14px;
  font-weight:600;
  padding:10px 20px;
  border-radius:8px;
  border:1px solid transparent;
  cursor:pointer;
  text-decoration:none;
  transition:transform .12s ease, background .12s ease;
}
.btn:active{transform:scale(0.97);}
.btn:disabled{opacity:0.6; cursor:default;}

.btn-ghost{
  background:transparent;
  border-color:var(--paper-line);
  color:var(--ink);
}
.btn-ghost:hover{background:#252319;}

.btn-solid{
  background:var(--ink);
  color:var(--paper);
}
.btn-solid:hover{background:#D8D2C2;}

.btn-accent{
  background:var(--accent);
  color:#0E1611;
}
.btn-accent:hover{background:#63C695;}

/* ---------- hero ---------- */
.hero-wrap{
  position:relative;
  width:100%;
  overflow:hidden;
  min-height:560px;
  display:flex;
  align-items:center;
}

.hero-bg{
  position:absolute;
  inset:0;
  background-image:url('/img/hero-bg.svg');
  background-size:cover;
  background-position:center 60%;
  z-index:0;
}

.hero-scrim{
  position:absolute;
  inset:0;
  background:
          linear-gradient(90deg, rgba(14,13,10,0.95) 0%, rgba(14,13,10,0.75) 38%, rgba(14,13,10,0.15) 75%),
          linear-gradient(0deg, var(--paper) 0%, rgba(14,13,10,0) 18%);
  z-index:1;
}

.hero{
  position:relative;
  z-index:2;
  max-width:1120px;
  margin:0 auto;
  padding:80px 32px 90px;
  width:100%;
}

.hero > div{
  max-width:560px;
}

.eyebrow{
  font-family:var(--mono);
  font-size:13px;
  color:var(--accent);
  text-transform:uppercase;
  letter-spacing:0.08em;
  margin-bottom:16px;
  text-shadow:0 2px 12px rgba(0,0,0,0.5);
}

h1{
  font-size:clamp(36px,5vw,54px);
  line-height:1.05;
  letter-spacing:-0.02em;
  margin:0 0 20px;
  text-shadow:0 2px 20px rgba(0,0,0,0.5);
}

.hero p.lead{
  font-size:18px;
  color:#D9D4C6;
  max-width:460px;
  margin:0 0 32px;
  text-shadow:0 2px 16px rgba(0,0,0,0.5);
}

.hero-actions{
  display:flex;
  gap:12px;
}

.hero-actions .btn{
  padding:14px 26px;
  font-size:15px;
}

/* receipt visual */
.receipt{
  background:#F5F1E7;
  max-width:300px;
  margin:0 auto;
  padding:28px 24px 20px;
  font-family:var(--mono);
  font-size:13px;
  color:#2b2a26;
  box-shadow:0 30px 60px -15px rgba(0,0,0,0.6);
  position:relative;
  transform:rotate(-2deg);
}

.receipt::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-8px;
  height:16px;
  background:
          linear-gradient(-45deg, transparent 8px, #F5F1E7 8px) 0 8px,
          linear-gradient(45deg, transparent 8px, #F5F1E7 8px) 0 8px;
  background-size:16px 16px;
  background-repeat:repeat-x;
  background-color:transparent;
  filter:drop-shadow(0 6px 6px rgba(0,0,0,0.35));
}

.receipt .r-title{
  text-align:center;
  font-weight:700;
  letter-spacing:0.05em;
  margin-bottom:4px;
}
.receipt .r-sub{
  text-align:center;
  color:#8a8579;
  font-size:11px;
  margin-bottom:16px;
}
.receipt .r-row{
  display:flex;
  justify-content:space-between;
  padding:4px 0;
  border-bottom:1px dashed #ddd8cc;
}
.receipt .r-row.total{
  border-bottom:none;
  border-top:1px solid #2b2a26;
  margin-top:6px;
  padding-top:10px;
  font-weight:700;
}
.receipt .r-tag{
  display:inline-block;
  margin-top:16px;
  background:var(--accent-soft);
  color:var(--accent);
  font-size:11px;
  padding:4px 10px;
  border-radius:20px;
}

/* ---------- generic content sections ---------- */
.section{
  max-width:1120px;
  margin:0 auto;
  padding:60px 32px;
}

.section-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:36px;
  border-bottom:1px solid var(--paper-line);
  padding-bottom:16px;
}

.section-head h2{
  font-size:26px;
  margin:0;
  letter-spacing:-0.01em;
}

.section-head span{
  font-family:var(--mono);
  font-size:13px;
  color:var(--ink-soft);
}

.steps{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:28px;
}

.step{
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:12px;
  padding:24px;
}

.step .num{
  font-family:var(--mono);
  color:var(--accent);
  font-size:13px;
  margin-bottom:12px;
}

.step h3{
  font-size:17px;
  margin:0 0 8px;
}

.step p{
  font-size:14px;
  color:var(--ink-soft);
  margin:0;
}

/* ---------- features ---------- */
.features{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1px;
  background:var(--paper-line);
  border:1px solid var(--paper-line);
  border-radius:12px;
  overflow:hidden;
}

.feature{
  background:var(--surface);
  padding:28px;
}

.feature h3{
  font-size:16px;
  margin:0 0 8px;
}

.feature p{
  font-size:14px;
  color:var(--ink-soft);
  margin:0;
}

/* ---------- CTA bottom ---------- */
.cta{
  text-align:center;
  padding:80px 32px 100px;
}

.cta h2{
  font-size:clamp(28px,4vw,40px);
  margin:0 0 16px;
  letter-spacing:-0.02em;
}

.cta p{
  color:var(--ink-soft);
  margin:0 0 28px;
}

footer{
  border-top:1px solid var(--paper-line);
  padding:24px 32px;
  display:flex;
  justify-content:space-between;
  font-size:13px;
  color:var(--ink-soft);
  max-width:1120px;
  margin:0 auto;
}

/* ---------- modal ---------- */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.6);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:50;
  padding:20px;
}
.overlay.open{display:flex;}

.modal{
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:14px;
  width:100%;
  max-width:380px;
  padding:32px;
  position:relative;
  box-shadow:0 30px 60px -15px rgba(0,0,0,0.7);
}

.modal h3{
  margin:0 0 4px;
  font-size:20px;
}
.modal p.sub{
  margin:0 0 24px;
  color:var(--ink-soft);
  font-size:14px;
}

.modal label{
  display:block;
  font-size:13px;
  font-weight:600;
  margin-bottom:6px;
  margin-top:16px;
}
.modal input{
  width:100%;
  padding:11px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:14px;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
}
.modal input::placeholder{
  color:var(--ink-soft);
  opacity:0.7;
}

.modal input:focus{
  outline:2px solid var(--accent);
  outline-offset:1px;
}

.modal .btn-accent{
  width:100%;
  margin-top:24px;
  padding:12px;
}
.modal--wide {
  width: 560px;
  max-width: 92vw;
}
.form-error{
  color:#F0A79E;
  font-size:13px;
  margin:14px 0 0;
  min-height:0;
}
.form-error:empty{
  margin:0;
}

.modal-close{
  position:absolute;
  top:16px; right:16px;
  background:none;
  border:none;
  font-size:18px;
  cursor:pointer;
  color:var(--ink-soft);
}

.switch-line{
  text-align:center;
  font-size:13px;
  color:var(--ink-soft);
  margin-top:16px;
}
.switch-line button{
  background:none;
  border:none;
  color:var(--accent);
  font-weight:600;
  cursor:pointer;
  padding:0;
  font-size:13px;
}

/* ---------- app pages (receipts / receipt items) ---------- */
main{
  max-width:840px;
  margin:0 auto;
  padding:48px 32px 80px;
}
main.narrow{ max-width:720px; }

.page-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:8px;
  padding-bottom:16px;
}
.page-head.with-border{
  margin-bottom:28px;
  border-bottom:1px solid var(--paper-line);
}

.page-head span{
  font-family:var(--mono);
  font-size:13px;
  color:var(--ink-soft);
}

.back-link{
  font-size:14px;
  color:var(--ink-soft);
  text-decoration:none;
  white-space:nowrap;
}
.back-link:hover{ color:var(--accent); }

.subhead{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:28px;
  border-bottom:1px solid var(--paper-line);
  padding-bottom:16px;
  font-size:14px;
  color:var(--ink-soft);
}
.subhead .total{
  font-family:var(--mono);
  color:var(--ink);
  font-weight:700;
}

table{
  width:100%;
  border-collapse:collapse;
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:12px;
  overflow:hidden;
}

thead th{
  text-align:left;
  font-family:var(--mono);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--ink-soft);
  padding:14px 20px;
  border-bottom:1px solid var(--paper-line);
}

tbody td{
  padding:14px 20px;
  border-bottom:1px solid var(--paper-line);
  font-size:14px;
}

tbody tr:last-child td{
  border-bottom:none;
}

tbody tr:hover{
  background:rgba(79,182,131,0.06);
}

td.amount, th.amount, td.qty, th.qty{
  text-align:right;
  font-family:var(--mono);
}
th.qty, td.qty{ width:70px; }
th.actions{ width:44px; }
td.actions{ text-align:right; padding-right:16px; }

.category-tag{
  display:inline-block;
  background:var(--accent-soft);
  color:var(--accent);
  font-size:12px;
  padding:3px 10px;
  border-radius:20px;
  white-space:nowrap;
}

.del-btn{
  background:transparent;
  border:1px solid var(--paper-line);
  color:var(--ink-soft);
  width:28px;
  height:28px;
  border-radius:6px;
  cursor:pointer;
  font-size:13px;
  line-height:1;
  transition:background .12s ease, color .12s ease, border-color .12s ease;
}
.del-btn:hover{
  background:#3A1A17;
  border-color:#6B3630;
  color:#F0A79E;
}

.edit-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:transparent;
  border:1px solid var(--paper-line);
  color:var(--ink-soft);
  width:28px;
  height:28px;
  border-radius:6px;
  font-size:13px;
  line-height:1;
  text-decoration:none;
  margin-right:6px;
  transition:background .12s ease, color .12s ease, border-color .12s ease;
}
.edit-link:hover{
  background:rgba(79,182,131,0.1);
  border-color:var(--accent);
  color:var(--accent);
}

.empty-note{
  color:var(--ink-soft);
  font-size:14px;
}

/* ---------- receipt upload ---------- */
.upload-card{
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:12px;
  padding:20px;
  margin-bottom:24px;
}

.upload-drop{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  text-align:center;
  padding:32px 20px;
  border:1.5px dashed var(--paper-line);
  border-radius:10px;
  cursor:pointer;
  transition:border-color .12s ease, background .12s ease;
}
.upload-drop:hover{
  border-color:var(--accent);
  background:rgba(79,182,131,0.04);
}
.upload-drop.drag-over{
  border-color:var(--accent);
  background:rgba(79,182,131,0.1);
}
.upload-drop.has-file{
  border-style:solid;
  border-color:var(--accent);
  background:rgba(79,182,131,0.06);
}
.upload-drop input[type="file"]{
  position:absolute;
  width:1px; height:1px;
  opacity:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
}

.upload-drop-title{
  font-size:15px;
  font-weight:700;
}

.upload-drop-text{
  font-size:13px;
  color:var(--ink-soft);
  font-family:var(--mono);
  word-break:break-all;
}
.upload-drop.has-file .upload-drop-text{
  color:var(--accent);
  font-weight:600;
}

.upload-drop-check{
  display:none;
  width:26px;
  height:26px;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:var(--accent-soft);
  color:var(--accent);
  font-size:14px;
  margin-top:2px;
}
.upload-drop.has-file .upload-drop-check{
  display:flex;
}

.upload-camera-btn{
  display:block;
  width:100%;
  margin-top:10px;
  padding:10px;
  background:transparent;
  border:1px solid var(--paper-line);
  border-radius:8px;
  color:var(--ink);
  font-family:var(--sans);
  font-size:13px;
  cursor:pointer;
  transition:border-color .12s ease, background .12s ease;
}
.upload-camera-btn:hover{
  border-color:var(--accent);
  background:rgba(79,182,131,0.04);
}

.upload-actions{
  display:flex;
  align-items:center;
  gap:12px;
  margin-top:16px;
}

.upload-indicator-text{
  font-size:13px;
  color:var(--ink-soft);
  font-family:var(--mono);
}

.upload-status{
  font-size:13px;
  margin:12px 0 0;
}
.upload-status:empty{ margin:0; }
.upload-status.ok{ color:var(--accent); }
.upload-status.error{ color:#F0A79E; }
.dash-list{
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:12px;
  overflow:hidden;
}

.dash-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  padding:22px 24px;
  text-decoration:none;
  color:var(--ink);
  border-bottom:1px solid var(--paper-line);
  transition:background .12s ease;
}
.dash-row:last-child{ border-bottom:none; }
.dash-row:hover{ background:rgba(79,182,131,0.06); }

.dash-row-main{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.dash-row-label{
  font-size:16px;
  font-weight:700;
}

.dash-row-desc{
  font-size:13px;
  color:var(--ink-soft);
}

.dash-row-count{
  font-family:var(--mono);
  font-size:24px;
  font-weight:700;
  color:var(--accent);
  flex-shrink:0;
}

/* ---------- inline forms (e.g. add category) ---------- */
.inline-form{
  display:flex;
  gap:10px;
  margin-bottom:8px;
}
.inline-form input{
  flex:1;
  padding:11px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:14px;
  background:var(--surface);
  color:var(--ink);
  font-family:var(--sans);
}
.inline-form input::placeholder{
  color:var(--ink-soft);
  opacity:0.7;
}
.inline-form input:focus{
  outline:2px solid var(--accent);
  outline-offset:1px;
}

/* categories table: hide/show itself and the empty-state note purely from
   whether its own tbody has rows — this stays correct after htmx adds or
   removes a row, with no extra server-side bookkeeping needed. */
#categories-table:has(#categories-body:empty){ display:none; }
#empty-note{ display:none; }
main:has(#categories-body:empty) #empty-note{ display:block; }

/* htmx swap animation for deleted rows */
tr.htmx-swapping{
  opacity:0;
  transition: opacity .2s ease-out;
}

@media (max-width:820px){
  .hero{padding-top:48px;}
  .steps{grid-template-columns:1fr;}
  .features{grid-template-columns:1fr;}
  .receipt{margin-top:20px;}
  header{padding:14px 18px;}
  .section{padding:44px 18px;}
  footer{flex-direction:column; gap:8px;}
  main{padding:32px 18px 60px;}
}

@media (max-width:560px){
  header{
    flex-wrap:wrap;
    row-gap:10px;
    padding:12px 16px;
  }
  .logo{ font-size:16px; gap:8px; }
  .nav-actions{
    flex-wrap:wrap;
    justify-content:flex-end;
    row-gap:8px;
    gap:8px;
    width:100%;
    min-width:0;
  }
  .nav-actions .btn{
    padding:8px 14px;
    font-size:13px;
  }
  .lang-switch summary{
    padding:8px 12px;
    font-size:12px;
  }
  .lang-switch-menu{
    right:0;
    left:auto;
    max-width:calc(100vw - 32px);
  }
}

@media (max-width:700px){
  th.qty, td.qty{display:none;}
}

:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}

/* ---------- error toast (surfaces failed htmx actions) ---------- */
#rg-toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translate(-50%, 12px);
  max-width:min(90vw, 420px);
  background:var(--surface);
  border:1px solid #6B3630;
  color:#F0A79E;
  font-size:13px;
  padding:12px 18px;
  border-radius:10px;
  box-shadow:0 20px 40px -12px rgba(0,0,0,0.6);
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
  z-index:100;
}
#rg-toast.show{
  opacity:1;
  transform:translate(-50%, 0);
}
#rg-toast.ok{
  border-color:var(--accent);
  color:var(--accent);
}
.terms-agree input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.terms-agree input[type="checkbox"]:hover {
  border-color: rgba(255,255,255,0.6);
}

.terms-agree input[type="checkbox"]:checked {
  background: var(--accent, #6ee7a0);
  border-color: var(--accent, #6ee7a0);
}

.terms-agree input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid #14130F;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.terms-agree input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent, #6ee7a0);
  outline-offset: 2px;
}
.dash-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px 32px;
  margin-top: 48px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: rgba(255,255,255,0.45);
}

.dash-footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.dash-footer-links a {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: color 0.15s;
}

.dash-footer-links a:hover {
  color: rgba(255,255,255,0.8);
}
/* ==========================================================================
   Additions for locale routing / standalone auth pages / cookie banner
   (uses the same custom properties as the rest of this file — --paper,
   --surface, --paper-line, --ink, --ink-soft, --accent, --accent-soft)
   ========================================================================== */

/* ---------- language switcher (pure <details>/<summary>, no JS) ---------- */
.lang-switch{
  position:relative;
  display:inline-block;
}
.lang-switch summary{
  list-style:none;
  display:flex;
  align-items:center;
  cursor:pointer;
  padding:10px 16px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-family:var(--sans);
  font-size:13px;
  font-weight:600;
  letter-spacing:0.02em;
  color:var(--ink);
  transition:border-color .12s ease, background .12s ease;
}
.lang-switch summary::-webkit-details-marker{ display:none; }
.lang-switch summary::marker{ content:""; }
.lang-switch summary:hover{
  border-color:var(--accent);
  background:rgba(79,182,131,0.04);
}
.lang-switch[open] summary{
  border-color:var(--accent);
}
.lang-switch-menu{
  position:absolute;
  top:calc(100% + 6px);
  right:0;
  min-width:170px;
  max-height:320px;
  overflow-y:auto;
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:10px;
  padding:6px;
  display:flex;
  flex-direction:column;
  box-shadow:0 20px 40px -12px rgba(0,0,0,0.6);
  z-index:40;
}
.lang-switch-menu a{
  padding:9px 12px;
  border-radius:6px;
  color:var(--ink);
  text-decoration:none;
  font-size:14px;
}
.lang-switch-menu a:hover{
  background:rgba(79,182,131,0.08);
}
.lang-switch-menu a.active{
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
}

/* ---------- standalone auth pages (replace the old modal) ---------- */
.auth-page{
  display:flex;
  justify-content:center;
}
.auth-card{
  width:100%;
  max-width:420px;
  margin:0 auto;
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:14px;
  padding:32px;
  display:flex;
  flex-direction:column;
}
.auth-card--wide{
  max-width:640px;
}
.auth-card--wide .terms-scroll{
  max-height:260px;
}
.auth-card h1{
  font-size:22px;
  margin:0 0 4px;
}
.auth-card p.sub{
  margin:0 0 24px;
  color:var(--ink-soft);
  font-size:14px;
}
.auth-card label{
  display:block;
  font-size:13px;
  font-weight:600;
  margin-bottom:6px;
  margin-top:16px;
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"],
.auth-card input[type="date"],
.auth-card input[type="number"],
.auth-card select,
.profile-card input[type="password"]{
  width:100%;
  padding:11px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:14px;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
}
.auth-card input[type="date"]{
  /* Tells the browser to render the native date picker (calendar
     popup) in dark mode instead of its default light theme, so it
     doesn't clash with the page. */
  color-scheme:dark;
}
.auth-card input[type="date"]::-webkit-calendar-picker-indicator{
  filter:invert(0.7);
  cursor:pointer;
  border-radius:4px;
}
.auth-card input[type="date"]::-webkit-calendar-picker-indicator:hover{
  filter:invert(0.9);
}
.auth-card select{
  appearance:none;
  -webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239C9789' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  padding-right:32px;
}
.auth-card input::placeholder{
  color:var(--ink-soft);
  opacity:0.7;
}
.auth-card input:focus,
.auth-card select:focus{
  outline:2px solid var(--accent);
  outline-offset:1px;
}
.auth-card .btn-accent{
  width:100%;
  margin-top:24px;
  padding:12px;
}
.auth-card .form-error{
  color:#F0A79E;
  font-size:13px;
  margin:14px 0 0;
}

/* terms box shown inline on the register page */
.terms-box{
  border:1px solid var(--paper-line);
  border-radius:10px;
  padding:16px;
  margin-top:8px;
  background:var(--paper);
}
.terms-box h4{
  margin:0 0 10px;
  font-size:14px;
}
.terms-scroll{
  max-height:160px;
  overflow-y:auto;
  font-size:13px;
  color:var(--ink-soft);
  padding-right:4px;
}
.terms-scroll p{ margin:0 0 10px; }
.terms-scroll ol{ margin:0 0 10px; padding-left:18px; }
.terms-scroll li{ margin-bottom:6px; }
.terms-scroll a{ color:var(--accent); }
.terms-agree{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin-top:14px;
  font-size:13px;
  color:var(--ink-soft);
  cursor:pointer;
}

/* ---------- cookie consent banner ---------- */
.cookie-banner{
  position:fixed;
  left:16px;
  right:16px;
  bottom:16px;
  z-index:100;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:16px;
  max-width:900px;
  margin:0 auto;
  padding:16px 20px;
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:12px;
  box-shadow:0 20px 40px -12px rgba(0,0,0,0.6);
}
.cookie-banner p{
  flex:1 1 320px;
  margin:0;
  font-size:13px;
  color:var(--ink-soft);
}
.cookie-banner .cookie-accept{
  flex:0 0 auto;
  padding:10px 20px;
}

/* ---------- receipts table rows as plain links (no onclick JS) ---------- */
a.row-link{
  display:block;
  color:inherit;
  text-decoration:none;
}

/* ---------- profile page: language picker list ---------- */
.language-pick-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.language-pick{
  display:inline-block;
  padding:9px 16px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  text-decoration:none;
  color:var(--ink);
  font-size:14px;
  transition:border-color .12s ease, background .12s ease, color .12s ease;
}
.language-pick:hover{
  border-color:var(--accent);
  background:rgba(79,182,131,0.04);
}
.language-pick.active{
  border-color:var(--accent);
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
}

.sr-only{
  position:absolute;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

@media (max-width:820px){
  .cookie-banner{ flex-direction:column; align-items:stretch; text-align:left; }
  .cookie-banner .cookie-accept{ width:100%; text-align:center; }
  .auth-card{ padding:24px; }
}

/* ---------- spending report page ---------- */
.spending-filters{
  display:flex;
  flex-direction:column;
  gap:20px;
  padding:24px;
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:14px;
  margin-bottom:28px;
}
.spending-filters-row{
  display:flex;
  gap:16px;
  flex-wrap:wrap;
}
.spending-field{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1 1 160px;
}
.spending-field label{
  font-size:13px;
  font-weight:600;
}
.spending-field input[type="date"]{
  padding:10px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:14px;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
  color-scheme:dark;
}
.spending-field input[type="date"]::-webkit-calendar-picker-indicator{
  filter:invert(0.7);
  cursor:pointer;
  border-radius:4px;
}
.spending-field input[type="date"]::-webkit-calendar-picker-indicator:hover{
  filter:invert(0.9);
}
.spending-categories{
  border:1px solid var(--paper-line);
  border-radius:10px;
  padding:14px 16px;
  margin:0;
}
.spending-categories legend{
  font-size:13px;
  font-weight:600;
  padding:0 6px;
}
.spending-categories-hint{
  margin:0 0 12px;
  font-size:12px;
  color:var(--ink-soft);
}
.spending-categories-list{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.spending-category-pick{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:13px;
  cursor:pointer;
}
.spending-category-pick input{
  accent-color:var(--accent);
}
.spending-filters .btn{
  align-self:flex-start;
  padding:11px 24px;
}

.spending-result{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:10px;
  padding:20px 24px;
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:14px;
  margin-bottom:24px;
}
.spending-total{
  display:flex;
  align-items:baseline;
  gap:12px;
}
.spending-total-label{
  font-size:14px;
  color:var(--ink-soft);
}
.spending-total-value{
  font-size:28px;
  font-weight:700;
  font-family:var(--mono);
}
.spending-matched{
  font-size:13px;
  color:var(--ink-soft);
}
.spending-breakdown-heading{
  font-size:15px;
  margin:0 0 12px;
}

@media (max-width:560px){
  .spending-filters{ padding:18px; }
  .spending-result{ flex-direction:column; align-items:flex-start; }
}

/* ---------- groups ---------- */
.group-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 20px;
  border:1px solid var(--paper-line);
  border-radius:12px;
  background:var(--surface);
  margin-bottom:10px;
  flex-wrap:wrap;
}
.group-row-actions{
  display:flex;
  gap:10px;
  flex-shrink:0;
}
.role-tag{
  display:inline-block;
  margin-left:8px;
  padding:2px 8px;
  border-radius:20px;
  font-size:11px;
  font-weight:600;
  letter-spacing:0.03em;
  text-transform:uppercase;
  background:rgba(255,255,255,0.06);
  color:var(--ink-soft);
  vertical-align:middle;
}
.role-tag.role-admin{
  background:var(--accent-soft);
  color:var(--accent);
}
.btn-danger{
  color:#F0A79E;
  border-color:#6B3630;
}
.btn-danger:hover{
  background:#3A1A17;
}

/* ---------- receipt <-> group move control ---------- */
.group-move-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px;
  margin:0 0 20px;
  padding:14px 18px;
  border:1px solid var(--paper-line);
  border-radius:10px;
  background:var(--surface);
}
.group-move-label{
  font-size:14px;
  color:var(--ink-soft);
}
.group-move-label strong{
  color:var(--ink);
}
.group-move-form{
  display:flex;
  gap:8px;
  align-items:center;
}
.group-move-form select{
  padding:8px 10px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:13px;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
}

/* ---------- misc form helper ---------- */
.field-hint{
  margin:0 0 8px;
  font-size:12px;
  color:var(--ink-soft);
}
.auth-card textarea{
  width:100%;
  padding:11px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:14px;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
  resize:vertical;
}
.auth-card textarea:focus{
  outline:2px solid var(--accent);
  outline-offset:1px;
}

@media (max-width:560px){
  .group-row{ flex-direction:column; align-items:flex-start; }
  .group-move-row{ flex-direction:column; align-items:flex-start; }
}

/* ---------- email confirmation ---------- */
.confirm-banner{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:14px;
  padding:14px 18px;
  margin-bottom:24px;
  border:1px solid #6B5A30;
  border-radius:10px;
  background:rgba(232,176,75,0.08);
}
.confirm-banner p{
  margin:0;
  font-size:14px;
  color:var(--ink);
  flex:1 1 240px;
}
.confirm-banner #confirm-resend-status{
  flex-basis:100%;
  font-size:13px;
  color:var(--ink-soft);
}

.confirm-tag{
  display:inline-block;
  padding:3px 10px;
  border-radius:20px;
  font-size:12px;
  font-weight:600;
  margin-right:8px;
}
.confirm-tag--ok{
  background:var(--accent-soft);
  color:var(--accent);
}
.confirm-tag--pending{
  background:rgba(232,176,75,0.15);
  color:#E8B04B;
}

.btn-small{
  padding:6px 12px;
  font-size:12px;
}

.profile-status{
  margin:8px 0 0;
  font-size:13px;
}
.profile-status.ok{ color:var(--accent); }
.profile-status.error{ color:#F0A79E; }

/* label + <select> for the optional group picker inside the upload form */
.upload-card label{
  display:block;
  font-size:13px;
  font-weight:600;
  margin:16px 0 6px;
}
.upload-card select{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--paper-line);
  border-radius:8px;
  font-size:14px;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
  appearance:none;
  -webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239C9789' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  padding-right:32px;
}
.upload-card select:focus{
  outline:2px solid var(--accent);
  outline-offset:1px;
}

/* ---------- reusable stacked page-head (title + meta + CTA) ---------- */
/* Used on pages whose header has more than just "back-link + title":
   a count/email on the side, and/or a primary action button. Splits
   into a small top row (back-link + meta) and a main row (title +
   action), and stacks the main row on mobile so the button never
   fights the title for space. */
.page-head-stack{
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-start;
  gap:14px;
}
.page-head-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.page-head-meta{
  font-family:var(--mono);
  font-size:13px;
  color:var(--ink-soft);
  white-space:nowrap;
}
.page-head-main{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.page-head-main h1{
  margin:0;
}
.page-head-action{
  flex-shrink:0;
  white-space:nowrap;
}

@media (max-width:560px){
  .page-head-main{
    flex-direction:column;
    align-items:stretch;
  }
  .page-head-action{
    width:100%;
    text-align:center;
  }
}

/* Lighter-touch pages: just "back-link + title" with no competing
   right-side content. Let the inner group wrap instead of overflowing
   if the translated title is long on a narrow screen. */
.page-head-simple{
  flex-wrap:wrap;
  row-gap:6px;
}

.profile-card{
  background:var(--surface);
  border:1px solid var(--paper-line);
  border-radius:12px;
  padding:20px 24px;
  margin-bottom:20px;
}
.profile-card h3{
  margin:0 0 16px;
  font-size:16px;
}
.profile-card-desc{
  margin:0 0 16px;
  font-size:13px;
  color:var(--ink-soft);
}
.profile-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 0;
  border-bottom:1px solid var(--paper-line);
  font-size:14px;
  flex-wrap:wrap;
  gap:8px;
}
.profile-row:last-child{ border-bottom:none; }
.profile-row-label{ color:var(--ink-soft); }

.profile-card label{
  display:block;
  font-size:13px;
  font-weight:600;
  margin:14px 0 6px;
}
.profile-card label:first-of-type{ margin-top:0; }

.rg-toast-container{
  position:fixed;
  top:24px;
  left:50%;
  transform:translateX(-50%);
  z-index:200;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
  width:100%;
  max-width:380px;
  padding:0 16px;
  pointer-events:none;
}
.rg-toast{
  display:block;
  width:100%;
  padding:18px 22px;
  background:linear-gradient(180deg, rgba(79,182,131,0.18), rgba(79,182,131,0.08)), var(--surface);
  border:2px solid var(--accent);
  border-radius:14px;
  box-shadow:0 0 0 4px rgba(79,182,131,0.12), 0 24px 48px -12px rgba(0,0,0,0.7);
  text-decoration:none;
  color:var(--ink);
  text-align:center;
  opacity:0;
  transform:translateY(-24px) scale(0.96);
  transition:opacity .3s ease, transform .3s ease;
  pointer-events:auto;
}
.rg-toast-visible{
  opacity:1;
  transform:translateY(0) scale(1);
}
.rg-toast-title{
  display:block;
  font-size:16px;
  font-weight:800;
  color:var(--accent);
}
.rg-toast-detail{
  display:block;
  margin-top:6px;
  font-size:14px;
  color:var(--ink);
}

@media (max-width:560px){
  .rg-toast-container{
    max-width:none;
  }
}

.receipt-files-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(140px, 1fr));
  gap:14px;
}
.receipt-file-card{
  border:1px solid var(--paper-line);
  border-radius:10px;
  overflow:hidden;
  background:var(--surface);
}
.receipt-file-card img{
  display:block;
  width:100%;
  aspect-ratio:3/4;
  object-fit:cover;
}
.receipt-file-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:8px 10px;
  font-size:12px;
  color:var(--ink-soft);
}