/* Geely CMS — minimal, in-house design that echoes the public site
   without depending on it. Uses the same brand colors (deep blue +
   sea-blue accent) and a clean editorial typography stack. */

:root {
  --gee-blue: #0E1A38;
  --gee-seagull: #2D8DC2;
  --paper: #FFFFFF;
  --paper-2: #F4F6FA;
  --paper-3: #E7ECF3;
  --ink: #0F172A;
  --mute: #64748B;
  --line-soft: #E5E9F0;
  --line-softer: #EFF2F7;
  --accent: #2D8DC2;
  --error: #DC2626;
  --ok: #16A34A;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--mute); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  font-family: inherit;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary {
  background: var(--gee-blue);
  color: #fff;
}
.btn-primary:hover { background: #1A2B5F; }
.btn-primary:disabled { background: #5B6478; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-soft);
}
.btn-ghost:hover { background: var(--paper-3); }

/* ---------- Forms ---------- */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  margin-top: 16px;
  margin-bottom: 6px;
}
.field {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,141,194,.18); }

.form-error {
  margin-top: 14px;
  font-size: 13px;
  color: var(--error);
}

/* ---------- Login page ---------- */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 32px rgba(15,23,42,.08);
}
.brand-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.brand-mark {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.18em;
  color: var(--gee-blue);
}
.brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}
.login-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.login-sub {
  margin: 0 0 20px;
  color: var(--mute);
  font-size: 14px;
}
#login-form .btn {
  width: 100%;
  margin-top: 24px;
  padding: 13px 18px;
  font-size: 15px;
}
.legal {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line-softer);
  font-size: 12px;
  color: var(--mute);
  text-align: center;
}

/* ---------- App shell ---------- */
.app-page { display: flex; flex-direction: column; min-height: 100vh; }
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
}
.app-header-right { display: flex; gap: 12px; align-items: center; }
.user-label { font-size: 13px; color: var(--mute); }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-side { display: none; }
}

.app-side {
  background: #fff;
  border-right: 1px solid var(--line-soft);
  padding: 16px 12px;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
.side-link:hover { background: var(--paper-3); text-decoration: none; }
.side-link.is-active { background: var(--gee-blue); color: #fff; }

.app-main { padding: 32px; }

.placeholder {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 720px;
}
.placeholder h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.placeholder p { margin: 8px 0; color: var(--ink); }
.placeholder.error { background: #FEF2F2; border-color: #FECACA; }
.placeholder.error h1 { color: var(--error); }

/* ---------- Sidebar states ---------- */
.side-link .tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--paper-3);
  color: var(--mute);
  border-radius: 999px;
  vertical-align: middle;
}
.side-link.is-active .tag { background: rgba(255,255,255,.2); color: rgba(255,255,255,.9); }
.side-link.is-disabled { opacity: 0.55; cursor: not-allowed; }
.side-link.is-disabled:hover { background: transparent; text-decoration: none; }
.is-hidden { display: none !important; }

.loading-pane {
  padding: 32px;
  color: var(--mute);
  font-size: 14px;
}

/* ---------- Tab generic ---------- */
.tab-section { max-width: 980px; }
.tab-head h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.tab-head p { margin: 0 0 24px; color: var(--mute); max-width: 640px; }

.card-form {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-softer);
}
.save-status { font-size: 13px; }

/* ---------- Provider cards (analytics) ---------- */
.provider-list {
  display: grid;
  gap: 14px;
}
.provider-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--paper-2);
  transition: border-color .12s ease, background .12s ease;
}
.provider-card.is-on {
  background: #F0F7FB;
  border-color: rgba(45,141,194,.4);
}
.provider-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.provider-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.provider-body { display: flex; flex-direction: column; gap: 8px; }
.provider-hint { font-size: 12px; margin: 0; }

/* ---------- Switch (toggle) ---------- */
.switch {
  display: inline-flex;
  position: relative;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  display: inline-block;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #C7CFDC;
  position: relative;
  transition: background .12s ease;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transition: transform .14s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(16px); }
.switch input:disabled + .switch-track { opacity: 0.55; cursor: not-allowed; }

/* ---------- Toast ---------- */
#toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--gee-blue);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(15,23,42,.18);
  max-width: 360px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .18s ease, transform .18s ease;
}
.toast-err  { background: var(--error); }
.toast-warn { background: #B45309; }
.toast.is-out { opacity: 0; transform: translateY(8px); }

/* ---------- Generic field-group inside cards ---------- */
.card-form .field-group { margin-bottom: 14px; }
.card-form .field-group:last-child { margin-bottom: 0; }
.card-form h2.section-h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.field-sm { padding: 6px 10px; font-size: 13px; }

.small { font-size: 12px; }

/* ---------- Lang tabs (RU/UZ/EN) ---------- */
.lang-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0;
  margin-bottom: 18px;
}
.lang-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--mute);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.lang-tab:hover { color: var(--ink); }
.lang-tab.is-active {
  color: var(--gee-blue);
  border-bottom-color: var(--gee-blue);
}

/* ---------- SEO tab ---------- */
.seo-toolbar { display: flex; flex-direction: column; gap: 6px; max-width: 540px; margin-bottom: 18px; }
.seo-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.seo-form { display: flex; flex-direction: column; gap: 14px; }
.seo-page-extra { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-softer); }
.seo-page-extra summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--mute); }
.seo-extra-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
@media (max-width: 760px) { .seo-extra-body { grid-template-columns: 1fr; } }

/* ---------- Content tab ---------- */
.tab-section.content-tab-split {
  max-width: none;
  width: 100%;
}
.content-split {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(520px, 1.4fr);
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .content-split { grid-template-columns: 1fr; }
}
.content-pane { display: flex; flex-direction: column; min-width: 0; }
.content-pane-preview { min-height: 70vh; }

.content-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.toolbar-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar-row .field-label { margin: 0; flex: 0 0 auto; }
.toolbar-row .field { flex: 1; min-width: 220px; }
.toolbar-row .lang-tabs { margin-bottom: 0; flex: 0 0 auto; border-bottom: none; }
.content-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.content-stats {
  padding: 14px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--line-softer);
}
.content-list {
  flex: 1;
  max-height: 58vh;
  overflow-y: auto;
}

/* ---------- Preview pane (iframe) ---------- */
.preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
}
.preview-url {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Device segmented control (Desktop / Mobile) */
.device-toggle {
  display: inline-flex;
  background: var(--paper-3);
  border-radius: 999px;
  padding: 2px;
  flex: 0 0 auto;
}
.device-btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  cursor: pointer;
  border-radius: 999px;
  font-family: inherit;
  transition: background .12s ease, color .12s ease;
}
.device-btn:hover { color: var(--ink); }
.device-btn.is-active {
  background: #fff;
  color: var(--gee-blue);
  box-shadow: 0 1px 2px rgba(15,23,42,.10);
}

.preview-frame-wrap {
  flex: 1;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.preview-frame-wrap iframe {
  width: var(--device-width, 100%);
  height: 100%;
  min-height: 60vh;
  border: 0;
  display: block;
  background: #fff;
}
.preview-frame-wrap.is-mobile {
  padding: 16px 0;
}
.preview-frame-wrap.is-mobile iframe {
  max-width: 100%;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(15,23,42,.12), 0 0 0 8px #1F2937;
}

/* ---------- Images-card embedded in Content tab ---------- */
.images-card {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}
.images-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.images-card > summary::-webkit-details-marker { display: none; }
.images-card > summary::before {
  content: "▸";
  font-size: 11px;
  color: var(--mute);
  margin-right: 6px;
  transition: transform .12s ease;
  display: inline-block;
}
.images-card[open] > summary::before { transform: rotate(90deg); }
.images-card-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  flex: 1;
}
.images-zones {
  padding: 0 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.zone-block {
  border-top: 1px solid var(--line-softer);
  padding-top: 12px;
}
.zone-block:first-child { border-top: none; padding-top: 0; }
.zone-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.zone-name { font-weight: 600; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink); }
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.img-tile-edit, .img-tile-empty {
  appearance: none;
  border: 1px solid var(--line-soft);
  background: #fff;
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
  text-align: left;
}
.img-tile-edit:hover, .img-tile-empty:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,141,194,.12);
}
.img-tile-edit:active { transform: scale(.98); }
.img-tile-edit .img-thumb {
  display: grid;
  place-items: center;
  background: var(--paper-3);
  aspect-ratio: 1;
  overflow: hidden;
}
.img-tile-edit .img-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.img-tile-edit .img-name {
  display: block;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  word-break: break-all;
  border-top: 1px solid var(--line-softer);
  background: #fff;
}
.img-tile-empty {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--mute);
  background: var(--paper-2);
  border-style: dashed;
}
.content-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-softer);
  align-items: start;
}
@media (max-width: 760px) { .content-row { grid-template-columns: 1fr; } }
.content-key {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--mute);
  word-break: break-all;
  padding-top: 8px;
}
.content-val .field { font-size: 13px; }

/* ---------- Images tab ---------- */
.img-toolbar { max-width: 540px; margin-bottom: 18px; }
.img-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.img-dropzone {
  border: 2px dashed var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  background: var(--paper-2);
  transition: border-color .15s ease, background .15s ease;
}
.img-dropzone.is-drag { border-color: var(--accent); background: #F0F7FB; }
.img-dropzone-text { font-size: 16px; font-weight: 600; }
.img-dropzone-sub { margin: 8px 0; }
.img-rules { margin-top: 12px; font-size: 12px; }
.img-progress { margin-top: 16px; }
.img-progress-bar {
  height: 6px;
  background: var(--paper-3);
  border-radius: 999px;
  overflow: hidden;
}
.img-progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .15s ease;
}
.img-progress-bar > #img-progress-fill { background: var(--accent); }
#img-progress-text { font-size: 12px; margin-top: 6px; }
.img-list-title {
  margin: 28px 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--mute);
}
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.img-tile {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.img-thumb {
  aspect-ratio: 1;
  background: var(--paper-3);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.img-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-tile figcaption { padding: 8px 10px; }
.img-name { font-size: 12px; font-weight: 600; word-break: break-all; }
.img-meta { font-size: 11px; margin-top: 2px; }

/* ---------- Forms tab ---------- */
.forms-list { display: flex; flex-direction: column; gap: 10px; }
.form-row {
  padding: 14px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line-softer);
  border-radius: var(--radius);
}
.form-row-name { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-row-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.form-row-meta code {
  background: var(--paper-3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-3);
  border-radius: 999px;
  color: var(--ink);
}
.badge-ok   { background: #DCFCE7; color: #166534; }
.badge-mute { background: var(--paper-3); color: var(--mute); }
.badge-err  { background: #FEE2E2; color: #991B1B; }

.integrations-list { display: grid; gap: 10px; }
.integration-row {
  padding: 14px 16px;
  border: 1px solid var(--line-softer);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.integration-row.is-on { background: #F0F9F4; border-color: #BBF7D0; }
.integration-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.is-on { background: var(--ok); }
.dot.is-off { background: var(--mute); }
.integration-row p { margin: 4px 0; font-size: 13px; }

/* ---------- Employees tab ---------- */
.user-create-form {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.user-create-form .field-group { margin-bottom: 0; }
@media (max-width: 760px) { .user-create-form { grid-template-columns: 1fr; } }

.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.grid-table th, .grid-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-softer);
}
.grid-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}
.grid-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
