:root {
  --red: #C41230; --red-dark: #8B0D21; --black: #0D0D0D;
  --gray-900: #1A1A1A; --gray-800: #2D2D2D; --gray-700: #3D3D3D;
  --gray-500: #6B6B6B; --gray-300: #CBCBCB; --gray-100: #F5F4F2;
  --white: #FFFFFF; --green: #22C55E; --gold: #C9A96E;
  --sidebar-w: 220px; --topbar-h: 60px; --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Lato', sans-serif; font-size: 15px; color: var(--gray-900); background: var(--gray-100); }
h1,h2,h3,h4 { font-family: 'Poppins', sans-serif; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .85rem; padding: 10px 22px; border-radius: 8px; transition: all .2s; cursor: pointer; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { opacity: .45; pointer-events: none; }
.btn-outline { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn-outline:hover { background: var(--red); color: #fff; }
.btn-ghost-dark { background: transparent; color: var(--gray-500); border: 1.5px solid var(--gray-300); }
.btn-ghost-dark:hover { border-color: var(--gray-500); color: var(--gray-900); }
.btn-sm { padding: 6px 14px; font-size: .78rem; }
.btn-danger { background: #EF4444; color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #16A34A; }
.w-full { width: 100%; }

/* ── Login ─────────────────────────────────────────────────────── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--gray-900) 0%, #2a0a12 100%); padding: 24px; }
.login-card { background: var(--white); border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { margin-bottom: 28px; display: flex; align-items: center; }
.login-logo img { height: 40px; filter: brightness(0); }
.login-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.login-card > p { color: var(--gray-500); margin-bottom: 28px; font-size: .9rem; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.error-msg { background: #FEE2E2; color: #DC2626; border-radius: 8px; padding: 10px 14px; font-size: .85rem; }

/* ── Admin Shell ────────────────────────────────────────────────── */
.admin-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.hidden { display: none !important; }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar { background: var(--gray-900); display: flex; flex-direction: column; padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 0 20px 24px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.sidebar-logo img { height: 32px; filter: brightness(0) invert(1); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; color: rgba(255,255,255,.55); font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .84rem; transition: all .2s; cursor: pointer; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active { background: var(--red); color: #fff; }
.sidebar-logout { display: flex; align-items: center; gap: 10px; padding: 12px 24px; color: rgba(255,255,255,.35); font-family: 'Poppins', sans-serif; font-size: .82rem; transition: color .2s; margin-top: 12px; }
.sidebar-logout svg { width: 16px; height: 16px; }
.sidebar-logout:hover { color: rgba(255,255,255,.7); }

/* ── Main ───────────────────────────────────────────────────────── */
.admin-main { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.topbar-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1rem; color: var(--gray-900); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── Views ─────────────────────────────────────────────────────── */
.view { display: none; padding: 28px; flex: 1; }
.view.active { display: block; }

/* ── Dashboard ─────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 28px; max-width: 500px; }
.dash-card { background: var(--white); border-radius: var(--radius); padding: 20px 24px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.dash-card-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dash-card-icon svg { width: 22px; height: 22px; color: #fff; fill: #fff; }
.dash-card-icon.red { background: var(--red); }
.dash-card-icon.green { background: var(--green); }
.dash-card-num { font-family: 'Poppins', sans-serif; font-size: 1.8rem; font-weight: 800; line-height: 1; }
.dash-card-label { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }
.dash-section, .dash-quick { background: var(--white); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.dash-section h3, .dash-quick h3 { font-size: 1rem; margin-bottom: 16px; }
.active-list { display: flex; flex-direction: column; gap: 12px; }
.active-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 10px; border: 1.5px solid var(--gray-100); }
.active-item-name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .9rem; }
.active-item-week { font-size: .82rem; color: var(--gray-500); }
.badge { font-family: 'Poppins', sans-serif; font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 50px; letter-spacing: .05em; }
.badge-red { background: rgba(196,18,48,.1); color: var(--red); }
.badge-green { background: rgba(34,197,94,.1); color: #16A34A; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-btn { display: flex; align-items: center; gap: 8px; padding: 14px 18px; background: var(--gray-100); border-radius: 10px; font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .85rem; transition: all .2s; text-align: left; }
.quick-btn:hover { background: var(--gray-200, #E5E5E5); transform: translateY(-1px); }
.quick-btn--csv { background: #EEF2FF; color: #4F46E5; }
.quick-btn--csv:hover { background: #E0E7FF; }
.quick-btn--ai { background: linear-gradient(135deg,#FFF7ED,#FEF3C7); color: #92400E; border: 1px solid #FDE68A; }
.quick-btn--ai:hover { background: linear-gradient(135deg,#FEF3C7,#FDE68A); transform: translateY(-1px); }

/* ── Menus list ─────────────────────────────────────────────────── */
.menus-filter { display: flex; gap: 8px; margin-bottom: 20px; }
.filter-btn { font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .82rem; padding: 7px 18px; border-radius: 50px; border: 1.5px solid var(--gray-300); color: var(--gray-500); transition: all .2s; }
.filter-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.menu-list-grid { display: flex; flex-direction: column; gap: 12px; }
.menu-list-item { background: var(--white); border-radius: var(--radius); padding: 18px 22px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1.5px solid transparent; transition: border-color .2s; }
.menu-list-item.is-active { border-color: var(--red); }
.menu-list-item-info { flex: 1; }
.menu-list-item-title { font-family: 'Poppins', sans-serif; font-weight: 700; }
.menu-list-item-week { font-size: .82rem; color: var(--gray-500); margin-top: 2px; }
.menu-list-actions { display: flex; gap: 8px; }

/* ── Form fields ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); }
.field input, .field textarea, .field select {
  padding: 10px 14px; border-radius: 8px; border: 1.5px solid var(--gray-300);
  outline: none; transition: border-color .2s; background: var(--white);
  color: var(--gray-900);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--red); }
.field textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.text-muted { color: var(--gray-500); font-size: .9rem; }
.mb-12 { margin-bottom: 12px; }

/* ── Menu form days ─────────────────────────────────────────────── */
.menu-form-days { display: flex; flex-direction: column; gap: 20px; }
.day-block { border: 1.5px solid var(--gray-100); border-radius: var(--radius); overflow: hidden; }
.day-block-header { background: var(--gray-100); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.day-block-header h4 { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: .9rem; }
.day-block-toggle { font-size: .75rem; color: var(--gray-500); display: flex; align-items: center; gap: 6px; font-family: 'Poppins', sans-serif; }
.day-block-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.day-no-service { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--gray-500); }
.day-no-service input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }
.option-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--gray-100); padding-top: 14px; margin-top: 4px; }
.side-group-label { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); grid-column: 1 / -1; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.modal { background: var(--white); border-radius: 16px; width: 100%; max-width: 780px; box-shadow: 0 24px 64px rgba(0,0,0,.2); position: relative; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--white); z-index: 1; border-radius: 16px 16px 0 0; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--gray-500); transition: all .2s; background: var(--gray-100); }
.modal-close:hover { background: var(--gray-300); }
.modal-tabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.modal-tab { flex: 1; padding: 8px; border-radius: 7px; font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .8rem; color: var(--gray-500); transition: all .2s; text-align: center; }
.modal-tab.active { background: var(--white); color: var(--gray-900); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.modal-body { padding: 20px 24px; max-height: 65vh; overflow-y: auto; }
.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 10px; }
.import-example { background: var(--gray-100); border-radius: 8px; padding: 10px 14px; font-size: .82rem; color: var(--gray-500); margin-bottom: 12px; }
.import-textarea { width: 100%; min-height: 220px; border: 1.5px solid var(--gray-300); border-radius: 8px; padding: 12px; font-family: 'Lato', monospace; font-size: .85rem; resize: vertical; line-height: 1.6; }
.import-textarea:focus { outline: none; border-color: var(--red); }
.file-input { display: none; }
.file-label { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px; border: 2px dashed var(--gray-300); border-radius: 12px; color: var(--gray-500); cursor: pointer; transition: all .2s; font-family: 'Poppins', sans-serif; font-size: .9rem; }
.file-label:hover { border-color: var(--red); color: var(--red); }
.file-label svg { width: 32px; height: 32px; }
.csv-preview { margin-top: 14px; padding: 14px; background: var(--gray-100); border-radius: 8px; font-size: .82rem; font-family: monospace; max-height: 200px; overflow-y: auto; }

/* ── Export ─────────────────────────────────────────────────────── */
.export-layout { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.export-controls { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06); display: flex; flex-direction: column; gap: 16px; }
.export-controls h3 { font-size: 1rem; margin-bottom: 4px; }
.export-preview-area { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-label { font-family: 'Poppins', sans-serif; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gray-500); }
.story-preview-wrap { width: 100%; max-width: 280px; aspect-ratio: 9/16; background: var(--gray-100); border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.story-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--gray-300); text-align: center; padding: 20px; font-size: .85rem; }
.story-empty svg { width: 48px; height: 48px; }
.story-preview-wrap canvas { width: 100% !important; height: auto !important; border-radius: 12px; }
.story-template { position: absolute; left: -9999px; top: -9999px; width: 1080px; height: 1920px; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 28px; right: 28px; background: var(--gray-900); color: #fff; padding: 12px 20px; border-radius: 10px; font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .85rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 9999; animation: slideUp .3s ease; }
.toast.success { background: #166534; }
.toast.error { background: #991B1B; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1024px) {
  .export-layout { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .option-group, .side-group { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
}
