:root {
  --onyx: #14100b;
  --onyx-soft: #1f1810;
  --ivory: #f7f2e9;
  --gold: #c6a15b;
  --gold-light: #e9cd94;
  --bronze: #8c6239;
  --ink: #221b14;
  --line: #e6ddc9;
  --success: #2f7d4f;
  --danger: #b23b2e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Work Sans', Arial, sans-serif; background: #f4f0e6; color: var(--ink); }
a { color: inherit; text-decoration: none; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 250px; background: var(--onyx); color: var(--ivory);
  display: flex; flex-direction: column; padding: 22px 16px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; border-bottom: 1px solid rgba(198,161,91,.25); margin-bottom: 20px; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold); display: flex; align-items: center; justify-content: center; font-family: 'Playfair Display', serif; color: var(--gold-light); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: 'Playfair Display', serif; font-size: 1rem; }
.brand-text small { color: #b7ab8f; font-size: .72rem; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 6px;
  color: #d9cfb8; font-size: .92rem;
}
.nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .85; }
.nav a:hover { background: rgba(198,161,91,.1); color: var(--ivory); }
.nav a.active { background: rgba(198,161,91,.18); color: var(--gold-light); }
.logout { display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: #d9cfb8; border-top: 1px solid rgba(198,161,91,.2); margin-top: 12px; padding-top: 16px; }
.logout svg { width: 18px; height: 18px; fill: currentColor; }
.logout:hover { color: var(--gold-light); }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 18px 28px;
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-family: 'Playfair Display', serif; font-size: 1.3rem; margin: 0; flex: 1; }
.admin-user { font-size: .88rem; color: #6b6152; }
.burger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.burger svg { width: 24px; height: 24px; }

.content { padding: 28px; flex: 1; }
.page-footer { padding: 16px 28px; font-size: .78rem; color: #9a8f78; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 18px; font-size: .9rem; }
.alert-success { background: #e6f3ea; color: var(--success); border: 1px solid #bfe2cc; }
.alert-danger { background: #fbe8e5; color: var(--danger); border: 1px solid #f0c4bd; }

/* Cards */
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--bronze); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-card.gold { border-left-color: var(--gold); }
.stat-card.positive { border-left-color: var(--success); }
.stat-card.negative { border-left-color: var(--danger); }
.stat-label { font-size: .8rem; color: #7a6f5c; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 1.5rem; }

/* Panels */
.panels-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: #fff; border: 1px solid var(--line); padding: 22px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { font-family: 'Playfair Display', serif; font-size: 1.15rem; margin: 0; }
.panel-head .hint { font-size: .8rem; color: #9a8f78; }
.link { font-size: .85rem; color: var(--bronze); }

/* Forms */
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: .82rem; color: #6b6152; font-weight: 500; }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; font-size: .92rem;
  font-family: inherit; background: #fdfbf6;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--onyx);
  border: none; padding: 12px 22px; font-weight: 600; border-radius: 4px; cursor: pointer; font-size: .92rem;
  display: inline-block; text-decoration: none;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-outline {
  border: 1px solid var(--bronze); color: var(--bronze); padding: 10px 18px; border-radius: 4px;
  background: #fff; font-size: .88rem; display: inline-flex; align-items: center; text-decoration: none;
}
.btn-outline:hover { background: rgba(140,98,57,.08); }

.search-inline { display: flex; gap: 8px; align-items: center; }
.search-inline input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; }
.search-inline button { padding: 9px 16px; border: none; background: var(--onyx); color: var(--ivory); border-radius: 4px; cursor: pointer; }

/* Tables */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { text-align: left; padding: 10px 12px; background: #faf6ec; color: #6b6152; font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f0ebdd; white-space: nowrap; }
.data-table .empty { text-align: center; color: #9a8f78; padding: 24px; }
.row-actions a { margin-right: 8px; font-size: 1rem; }

.badge { padding: 4px 10px; border-radius: 12px; font-size: .76rem; font-weight: 600; }
.badge-pending { background: #fff3d6; color: #8a6d1c; }
.badge-in-progress { background: #dbe9fb; color: #29578a; }
.badge-ready { background: #e0f3e6; color: #2b7a45; }
.badge-delivered { background: #e6e6e6; color: #444; }
.badge-cancelled { background: #fbe1de; color: #a13a2b; }
.badge-select { border: none; font-size: .78rem; font-weight: 600; border-radius: 12px; padding: 4px 8px; cursor: pointer; }

/* P&L table */
.pl-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin-bottom: 10px; }
.pl-table td { padding: 9px 6px; border-bottom: 1px solid #f0ebdd; }
.pl-table td:last-child { text-align: right; font-weight: 500; }
.pl-table .section-row td { background: #faf6ec; font-weight: 700; color: var(--bronze); padding-top: 12px; padding-bottom: 8px; }
.pl-table .total-row td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.pl-table .net-row td { font-weight: 700; font-size: 1.05rem; }
.pl-table .net-row.positive td { color: var(--success); }
.pl-table .net-row.negative td { color: var(--danger); }

.hero-preview { width: 100%; max-height: 200px; object-fit: cover; border: 1px solid var(--line); }

/* Modal (popup form) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,16,11,.6);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; max-width: 820px; width: 100%; max-height: 88vh;
  overflow-y: auto; padding: 30px; position: relative; border-top: 3px solid var(--gold);
}
.modal-box h2 { font-family: 'Playfair Display', serif; font-size: 1.2rem; margin: 0 0 4px; }
.modal-box .hint { font-size: .82rem; color: #9a8f78; display: block; margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  font-size: 1.5rem; line-height: 1; cursor: pointer; color: #6b6152;
}
.modal-close:hover { color: var(--danger); }
.panel-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Login */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center; font-family: 'Work Sans', sans-serif;
}
.login-card {
  background: rgba(20,16,11,.82); backdrop-filter: blur(6px);
  border: 1px solid rgba(198,161,91,.4); padding: 40px 36px; width: 100%; max-width: 380px;
  color: var(--ivory); text-align: center;
}
.login-mark {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center; font-family: 'Playfair Display', serif;
  font-size: 1.5rem; color: var(--gold-light);
}
.login-card h1 { font-family: 'Playfair Display', serif; margin: 0 0 6px; font-size: 1.4rem; }
.login-sub { color: #c9bfa4; font-size: .85rem; margin-bottom: 20px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-card label { font-size: .8rem; color: #d9cfb8; }
.login-card input {
  padding: 11px 12px; border: 1px solid rgba(198,161,91,.35); border-radius: 4px;
  background: rgba(255,255,255,.06); color: var(--ivory);
}
.login-card button {
  margin-top: 10px; padding: 12px; border: none; border-radius: 4px; cursor: pointer;
  background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: var(--onyx); font-weight: 600;
}
.back-link { display: inline-block; margin-top: 18px; font-size: .82rem; color: #c9bfa4; }

/* Language switch */
.lang-switch { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.lang-switch a {
  padding: 4px 12px; border: 1px solid rgba(198,161,91,.4); border-radius: 12px;
  font-size: .74rem; color: #c9bfa4; letter-spacing: .03em;
}
.lang-switch a.active { background: var(--gold); color: var(--onyx); border-color: var(--gold); font-weight: 700; }
.topbar .lang-switch { margin: 0; }
.topbar .lang-switch a { color: var(--bronze); border-color: var(--bronze); }
.topbar .lang-switch a.active { background: var(--bronze); color: #fff; }

@media (max-width: 980px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .panels-grid, .grid-form { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .25s; }
  .sidebar.open { left: 0; }
  .burger { display: block; }
}
