/* =========================================================================
   CIPRIAN — Admin panel (clean SaaS, distinct from the public brand)
   ========================================================================= */
:root {
    --a-bg: #F5F4F0;
    --a-panel: #FFFFFF;
    --a-line: #E6E3DC;
    --a-ink: #1F1E1B;
    --a-muted: #6E6A62;
    --a-faint: #9C988F;
    --a-brand: #B9573F;
    --a-brand-600: #A34A33;
    --a-pine: #365447;
    --a-amber: #B9772E;
    --a-red: #B03A2E;
    --a-green: #2F6B4F;
    --a-radius: 12px;
    --a-font: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--a-font); background: var(--a-bg); color: var(--a-ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; }

.admin-shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 960px) { .admin-shell { grid-template-columns: 232px 1fr; } }

.admin-sidebar { background: #201F1B; color: #C9C5BC; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (max-width: 959px) { .admin-sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; } }
.admin-sidebar .brand { display: flex; align-items: center; gap: 8px; padding: 6px 10px 18px; font-weight: 700; color: #fff; }
.admin-sidebar .brand img { width: 26px; height: 26px; }
.admin-sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #C9C5BC; font-weight: 500; font-size: 13.5px; }
.admin-sidebar a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-sidebar a.nav.active { background: var(--a-brand); color: #fff; }
.admin-sidebar a.nav svg { width: 16px; height: 16px; }
.admin-sidebar .group-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #6e6a62; padding: 16px 12px 6px; }

.admin-main { padding: 24px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.admin-topbar h1 { font-size: 20px; }
.admin-topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--a-muted); }

/* cards / stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 760px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius); padding: 16px; }
.stat .label { font-size: 12px; color: var(--a-muted); }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat .delta { font-size: 12px; color: var(--a-green); }

.panel { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-radius); padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin-bottom: 14px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; color: var(--a-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--a-line); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FAF9F6; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-confirmed, .pill-paid { background: #E7F2EC; color: var(--a-green); }
.pill-pending { background: #FBF0DF; color: var(--a-amber); }
.pill-cancelled, .pill-refunded, .pill-failed, .pill-no_show { background: #FBE9E7; color: var(--a-red); }
.pill-completed { background: #E9EEF4; color: #263A4A; }

/* buttons & forms (admin) */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; border: 1px solid transparent; transition: background .15s; }
.btn-primary { background: var(--a-brand); color: #fff; }
.btn-primary:hover { background: var(--a-brand-600); }
.btn-outline { background: #fff; border-color: var(--a-line); color: var(--a-ink); }
.btn-outline:hover { border-color: var(--a-ink); }
.btn-danger { background: #fff; border-color: #F0C9C2; color: var(--a-red); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--a-muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
    width: 100%; border: 1.5px solid var(--a-line); border-radius: 9px; padding: 9px 12px;
    background: #fff; font-size: 14px; color: var(--a-ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--a-brand); }
.field textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; }
.alert-error { background: #FBE9E7; color: #7C2B20; }
.alert-success { background: #E7F2EC; color: #1F5638; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 16px; padding: 32px; }
.login-card .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; margin-bottom: 6px; }

/* calendar (admin availability) */
.cal-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-mini .dow { text-align: center; font-size: 10.5px; text-transform: uppercase; color: var(--a-faint); padding: 4px 0; font-weight: 700; }
.cal-mini .day { aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; border: 1px solid var(--a-line); background: #fff; cursor: pointer; }
.cal-mini .day.empty { border: none; background: transparent; cursor: default; }
.cal-mini .day.closed { background: #FBE9E7; color: var(--a-red); }
.cal-mini .day.today { border-color: var(--a-brand); }
.cal-mini .day:hover { border-color: var(--a-ink); }

.muted { color: var(--a-muted); }
.small { font-size: 12.5px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; }

/* status pills (admin) */
.pill-published { background: #E7F2EC; color: var(--a-green); }
.pill-draft { background: #EFEFEB; color: var(--a-muted); }
.pill-archived { background: #F3ECE4; color: var(--a-amber); }

/* tour editor tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--a-line); flex-wrap: wrap; }
.atab { border: none; background: transparent; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--a-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.atab:hover { color: var(--a-ink); }
.atab.active { color: var(--a-brand); border-bottom-color: var(--a-brand); }
.atab-panel.hidden, .langpanel.hidden { display: none; }

/* language tabs */
.langtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.langtab { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--a-line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--a-ink); }
.langtab.active { border-color: var(--a-brand); color: var(--a-brand); background: #FBF1EE; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #D8D4CC; }
.dot-on { background: var(--a-green); }

/* repeaters (itinerary / faq) */
.repeat-row { display: grid; gap: 8px; align-items: start; margin-bottom: 8px; }
.repeat-row--itin { grid-template-columns: 1fr 1fr 2fr auto; }
.repeat-row--faq { grid-template-columns: 1fr 2fr auto; }
.repeat-row input, .repeat-row textarea { border: 1.5px solid var(--a-line); border-radius: 9px; padding: 8px 11px; font-size: 13.5px; color: var(--a-ink); width: 100%; }
.repeat-row input:focus, .repeat-row textarea:focus { outline: none; border-color: var(--a-brand); }

/* checkbox grid for tour languages */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.field label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--a-ink); cursor: pointer; }
.field label.inline input[type="checkbox"] { width: auto; }

/* field-centric translation editor */
.tr-editor { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .tr-editor { grid-template-columns: 1fr; } }
.tr-nav { display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--a-line); padding-right: 12px; position: sticky; top: 12px; }
@media (max-width: 760px) { .tr-nav { flex-direction: row; flex-wrap: wrap; border-right: none; padding-right: 0; position: static; } }
.tr-field-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: none; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--a-muted); cursor: pointer; }
.tr-field-nav:hover { background: #F5F2EC; color: var(--a-ink); }
.tr-field-nav.active { background: #FBF1EE; color: var(--a-brand); }
.tr-field-nav.is-complete .tr-count { background: var(--a-green); color: #fff; }
.tr-count { font-size: 11px; font-weight: 700; background: #EFECE5; color: var(--a-muted); border-radius: 999px; padding: 1px 7px; min-width: 34px; text-align: center; }

.tr-panel { background: #FBF9F5; border: 1px solid var(--a-line); border-radius: 12px; padding: 14px; }
.tr-panel.hidden { display: none; }
.tr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-head h4 { font-size: 14px; font-weight: 700; }
.tr-head .btn { margin-left: auto; }
.tr-source-box { background: #F2EFE8; border: 1px solid var(--a-line); border-radius: 9px; padding: 10px 12px; margin-bottom: 14px; }
.tr-source-box label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--a-muted); margin-bottom: 6px; }
.tr-source-box input, .tr-source-box textarea { width: 100%; border: 1px solid var(--a-line); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; color: var(--a-ink); }
.tr-source-box input[readonly], .tr-source-box textarea[readonly] { color: var(--a-muted); background: #FBF9F5; }
.tr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .tr-grid { grid-template-columns: 1fr; } }
.tr-cell { border: 1px solid var(--a-line); border-radius: 9px; padding: 8px 10px; background: #fff; }
.tr-cell > label { display: block; font-size: 12px; font-weight: 700; color: var(--a-ink); margin-bottom: 5px; }
.tr-cell input, .tr-cell textarea { width: 100%; border: 1.5px solid var(--a-line); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--a-ink); }
.tr-cell input:focus, .tr-cell textarea:focus { outline: none; border-color: var(--a-brand); }
.tr-cell textarea { min-height: 60px; resize: vertical; }

/* =========================================================================
   Tour editor — professional sectioned form
   ========================================================================= */
.tour-editor { max-width: 1080px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.editor-head h2 { font-size: 20px; font-weight: 700; }
.editor-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.editor-slug { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--a-muted); }
.editor-head-right { display: flex; gap: 8px; }

.form-section { border: 1px solid var(--a-line); border-radius: var(--a-radius); background: #fff; margin-bottom: 16px; overflow: hidden; }
.form-section-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: #FBFAF7; border-bottom: 1px solid var(--a-line); }
.form-section-icon { flex: none; width: 34px; height: 34px; border-radius: 9px; background: #FBF1EE; color: var(--a-brand); display: inline-flex; align-items: center; justify-content: center; }
.form-section-icon svg { width: 17px; height: 17px; }
.form-section-head h3 { font-size: 14px; font-weight: 700; margin: 2px 0 2px; }
.form-section-head p { margin: 0; font-size: 12.5px; color: var(--a-muted); }
.form-section-body { padding: 16px; }

.req { color: var(--a-red); font-weight: 700; }
.hint { font-weight: 500; color: var(--a-faint); }

.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; } }

/* sticky action bar */
.editor-actions { position: sticky; bottom: 14px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--a-line); border-radius: 12px; padding: 12px 16px; box-shadow: 0 6px 24px rgba(31, 30, 27, .08); }
.editor-actions-right { display: flex; gap: 8px; }

/* media upload */
.up-row { display: flex; gap: 8px; align-items: center; }
.up-row input[type="text"], .up-row textarea { flex: 1; }
.up-row .btn { flex: none; }
/* upload zone (button + hint, drag & drop target) */
.up-zone {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    border: 1.5px dashed var(--a-line); border-radius: 12px; padding: 14px 16px;
    background: #FBFAF7; transition: border-color .15s, background .15s;
}
.up-zone.drag { border-color: var(--a-brand); background: #FBF1EE; }
.up-zone .btn { flex: none; }
.up-zone .small { color: var(--a-muted); }
.up-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.up-item { position: relative; width: 132px; }
.up-thumb { width: 132px; height: 84px; object-fit: cover; border-radius: 9px; border: 1px solid var(--a-line); background: #F2EFE8; display: block; }
.up-del {
    position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid #E5B7AC; background: #fff; color: var(--a-red); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 4px rgba(31, 30, 27, .18); transition: background .15s, transform .15s;
}
.up-del:hover { background: #FBE9E7; transform: scale(1.08); }
.up-msg { display: none; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--a-red); background: #FBE9E7; border: 1px solid #F0C9C2; border-radius: 8px; padding: 8px 11px; }
.up-msg.show { display: block; }
.up-item img { transition: opacity .2s; }
.up-item.is-deleting { opacity: .4; pointer-events: none; }
