:root {
  --deep: #05200f;
  --green: #0a3b22;
  --gold: #d9a537;
  --gold-2: #c99120;
  --cream: #f7f1e3;
  --ink: #14301f;
  --line: #e4d8c4;
  --muted: #6e6455;
  --danger: #a32219;
  --ok: #1a7a3a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #efe7d8;
  font-family: "Hind Siliguri", sans-serif;
}

button, input, textarea, select { font: inherit; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, #1e7a46 0, transparent 42%),
    var(--deep);
}

.login-card {
  width: min(420px, 100%);
  background: var(--cream);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: 0 20px 50px #00000055;
}

.login-card img { width: 150px; margin: 0 auto 8px; display: block; }
.login-card h1 { margin: 0; display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 28px; }
.login-card p { text-align: center; color: var(--muted); margin: 8px 0 18px; }
.login-card label, .field { display: block; font-weight: 600; }
.login-card label > span { display: inline-flex; align-items: center; gap: 6px; }
.login-card input, .field input, .field textarea, .field select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #d9cdb4;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
.login-card button, .save {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(135deg, #e7b948, #c99120);
  color: var(--deep);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-error { color: var(--danger); min-height: 1.2em; }

.app { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.side {
  background: var(--deep);
  color: var(--cream);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; min-width: 0; }
.side-brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: #ffffff18; flex: none; }
.side-brand div { min-width: 0; }
.side-brand strong { display: block; font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-brand span { color: var(--gold); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.side nav { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; }
.side nav .nav-pin {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0a3b22;
  border: 1px solid #d9a53766;
  font-weight: 700;
}
.side button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--cream);
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
}
.side button i { width: 1.15em; text-align: center; }
.side button.active, .side button:hover { background: #ffffff18; }
.side button.active { color: var(--gold); font-weight: 700; }
.side-link {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  text-decoration: none;
  padding: 12px;
  font-weight: 700;
}

.main { min-width: 0; }
.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: #fffdf8ee;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.top h1 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 24px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
#save-state { color: var(--muted); font-size: 14px; }
.ghost, .mini, .danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}
.save { width: auto; margin: 0; padding: 10px 16px; }
.panel { padding: 22px; display: grid; gap: 14px; max-width: 920px; }
.card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.card h2 { margin: 0; font-size: 18px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field textarea { min-height: 90px; resize: vertical; }
.field.color { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.field.color span { grid-column: 1 / -1; }
.field.color input[type="color"] { width: 54px; height: 46px; padding: 4px; margin: 0; }
.image-field img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: var(--deep);
  border-radius: 12px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.section-card { display: grid; gap: 10px; }
.section-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; }
.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: #ffffff18; gap: 2px; }
.login .lang-switch { background: #efe4cc; margin: 0 auto 14px; }
.lang-switch button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.lang-switch button.active { background: var(--gold); color: var(--deep); }
.login .lang-switch button { color: var(--ink); }

.orders-page { display: grid; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats.report-stats { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.stat span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong { display: block; margin-top: 4px; font-size: 28px; line-height: 1; }
.stat.new strong { color: #9a6b12; }
.stat.confirmed strong { color: var(--ok); }
.stat.delivered strong { color: #0b6b4a; }
.order-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-box {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
  color: var(--muted);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 11px 0;
  background: transparent;
  color: var(--ink);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}
.chips button.active { background: var(--deep); color: var(--cream); border-color: var(--deep); }
.report-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.report-filters label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.report-filters label span, .card h2, .dialog-row span { display: flex; align-items: center; gap: 6px; }
.report-filters input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
.chart-card h2 { margin: 0; font-size: 16px; }
.chart-scroll { overflow-x: auto; padding-top: 4px; }
.report-chart { display: block; font-family: "Hind Siliguri", sans-serif; }
.report-list { display: grid; gap: 10px; }
.report-day {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.report-day-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.report-date { font-weight: 700; }
.report-count { font-size: 26px; line-height: 1; color: var(--deep); text-align: right; }
.report-count small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.report-orders { display: grid; gap: 8px; }
.orders { display: grid; gap: 8px; }
.order {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid #eadfcd;
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 6px 16px #14301f0c;
  cursor: pointer;
}
.order:hover { border-color: #d9c7a4; }
.order-mark { width: 6px; height: 28px; border-radius: 999px; background: var(--gold); }
.order.is-confirmed .order-mark { background: var(--ok); }
.order.is-delivered .order-mark { background: #0b6b4a; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--deep);
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
}
.order-brief { min-width: 0; }
.order-name { display: block; font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-side { display: grid; justify-items: end; gap: 4px; }
.order-total { font-size: 16px; line-height: 1; color: var(--deep); white-space: nowrap; }
.order-phone { color: var(--green); font-weight: 700; text-decoration: none; }
.order-phone:hover { text-decoration: underline; }
.order-dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #05200fcc;
}
.order-dialog-card {
  width: min(520px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: #fffdf8;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 24px 60px #00000055;
}
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 22px; }
.dialog-head time { color: var(--muted); font-size: 13px; }
.dialog-rows { display: grid; gap: 12px; margin: 16px 0; }
.dialog-row { display: grid; gap: 2px; }
.dialog-row span { color: var(--muted); font-size: 12px; font-weight: 700; }
.dialog-row p, .dialog-row strong { margin: 0; line-height: 1.45; }
.dialog-address { white-space: pre-line; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dialog-actions select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  min-width: 140px;
}
.dialog-actions .danger { margin-left: auto; color: var(--danger); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  background: #f3e7c3;
  color: #7a5a16;
}
.order-sub i { margin-right: 2px; }
.badge.confirmed { background: #d9f3e2; color: var(--ok); }
.badge.delivered { background: #d7efe4; color: #0b6b4a; }
.muted { color: var(--muted); margin: 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

@media (max-width: 680px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { display: grid; grid-template-columns: 1fr 1fr; }
  .side nav .nav-pin { grid-column: 1 / -1; }
  .grid, .stats, .stats.report-stats { grid-template-columns: 1fr 1fr; }
  .dialog-actions .danger { margin-left: 0; }
  .top { align-items: flex-start; flex-direction: column; }
}
