:root {
  --red: #e31b23;
  --red-dark: #b90f18;
  --ink: #171313;
  --ink-2: #2c2624;
  --muted: #716662;
  --paper: #fbf8f6;
  --panel: #fff;
  --line: #dfd5d0;
  --good: #168558;
  --warn: #b56b08;
  --bad: #c92828;
  --shadow: 0 24px 70px rgba(53, 25, 20, .11);
  --max: 1460px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: "Segoe UI", Inter, Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .8fr) minmax(560px, 1.2fr); background: #fff; }
.login-card { width: min(520px, calc(100% - 64px)); margin: auto; padding: 60px 0; }
.admin-brand img { width: 190px; height: 58px; object-fit: contain; object-position: left center; }
.login-kicker { margin: 62px 0 16px; color: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.login-card h1 { max-width: 500px; margin: 0; font-size: clamp(42px, 4.8vw, 64px); line-height: 1; letter-spacing: -.055em; }
.language-switch { display: inline-flex; border: 1px solid #5a4d49; }
.language-switch button { min-width: 39px; padding: 9px 8px; border: 0; color: #cdbfba; background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.language-switch button.active { color: #fff; background: var(--red); }
.admin-language-switch { margin-top: 28px; border-color: var(--line); }.admin-language-switch button { color: var(--muted); }
.login-copy { max-width: 520px; margin: 24px 0 34px; color: var(--muted); line-height: 1.7; }
.login-card form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; }
label > span { color: #5c524f; font-size: 11px; font-weight: 750; letter-spacing: .04em; }
input, select, textarea { width: 100%; max-width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: #fff; outline: none; }
input, select { min-height: 45px; padding: 0 12px; }
textarea { min-height: 90px; padding: 12px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,27,35,.08); }
.primary-button { min-height: 50px; display: inline-flex; align-items: center; justify-content: space-between; gap: 30px; border: 0; padding: 0 18px; color: #fff; background: var(--red); font-size: 13px; font-weight: 800; }
.primary-button:hover { background: var(--red-dark); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.primary-button.full { width: 100%; margin-top: 20px; }
.form-status { min-height: 20px; margin: 0; color: var(--bad); font-size: 12px; }
.back-link { display: inline-block; margin-top: 32px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--red); }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; padding: 60px; background: var(--ink); }
.art-grid { position: absolute; inset: 0; opacity: .18; background-image: linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px); background-size: 46px 46px; }
.login-art img { position: relative; width: min(620px, 80%); padding: 48px 42px; background: #fff; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.login-art span { position: absolute; left: 50px; bottom: 40px; color: #cdbfba; font: 700 10px/1 Consolas, monospace; letter-spacing: .15em; }

.admin-header { position: sticky; top: 0; z-index: 30; color: #fff; background: rgba(23,19,19,.97); backdrop-filter: blur(14px); }
.header-inner { width: min(var(--max), calc(100% - 48px)); min-height: 70px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.admin-brand.compact img { width: 145px; height: 44px; filter: brightness(0) invert(1); object-fit: contain; object-position: left center; }
.header-actions { display: flex; align-items: center; gap: 18px; font-size: 11px; }
.session-user { color: #a99b96; }.session-user i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #42cf85; }
.session-user strong { color: #fff; }
.header-link { color: #cfc2bd; }.header-link:hover { color: #ff756d; }
.header-actions button { min-height: 34px; border: 1px solid #655650; padding: 0 13px; color: #fff; background: transparent; }
.header-actions button:hover { border-color: var(--red); background: var(--red); }

.admin-shell { width: min(var(--max), calc(100% - 48px)); margin: auto; padding: 58px 0 90px; }
.admin-title { display: flex; justify-content: space-between; align-items: end; gap: 50px; }
.admin-title h1 { margin: 0; font-size: clamp(38px, 5vw, 64px); line-height: 1; letter-spacing: -.055em; }
.admin-title > div > p:last-child { margin: 16px 0 0; color: var(--muted); }
.refresh-button { min-height: 40px; border: 1px solid var(--ink); padding: 0 15px; background: transparent; font-size: 12px; font-weight: 750; }
.refresh-button:hover { color: #fff; background: var(--ink); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 45px 0 28px; }
.summary-grid article { min-height: 124px; padding: 20px; border: 1px solid var(--line); background: #fff; }
.summary-grid span { display: block; color: var(--muted); font-size: 11px; }
.summary-grid strong { display: block; margin: 17px 0 8px; font-size: 34px; line-height: 1; }
.summary-grid small { color: #9a8e89; font-size: 10px; }

.tab-nav { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab-button { min-height: 52px; border: 0; border-bottom: 3px solid transparent; padding: 0 20px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tab-button:hover, .tab-button.active { color: var(--red); border-bottom-color: var(--red); }
.tab-panel { display: none; padding-top: 24px; }.tab-panel.active { display: block; }
.workspace-grid { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 18px; align-items: start; }
.editor-card, .list-card { min-width: 0; border: 1px solid var(--line); background: #fff; box-shadow: 0 12px 34px rgba(53,25,20,.04); }
.editor-card { position: sticky; top: 94px; padding: 22px; }
.list-card { padding: 22px; min-width: 0; }
.card-heading { min-height: 48px; display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.card-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.text-button { border: 0; padding: 4px 0; color: var(--red); background: transparent; font-size: 11px; font-weight: 800; }
.count-chip { min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px; color: var(--muted); background: #f2ece8; font-size: 10px; font-weight: 750; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; min-width: 0; }
.form-grid > label { min-width: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.language-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 8px 0 2px; padding: 15px 16px; border-left: 3px solid var(--red); background: #f8f3f1; }
.language-heading div { display: grid; gap: 4px; }.language-heading b { font-size: 14px; }.language-heading span { color: var(--muted); font-size: 11px; }
.english-heading { margin-top: 14px; border-left-color: var(--ink); }
.translate-button { padding: 10px 14px; border: 0; color: #fff; background: var(--red); font-size: 12px; font-weight: 800; cursor: pointer; }
.check-field { display: flex; align-items: center; gap: 10px; padding: 4px 0; }.check-field input { width: 17px; min-height: 17px; accent-color: var(--red); }.check-field span { font-size: 12px; }
.file-field input { padding: 10px; }
.image-preview { overflow: hidden; display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--line); background: var(--paper); }
.image-preview img { width: 96px; height: 68px; object-fit: cover; background: #f4ebe6; }
.image-preview p { margin: 0; color: var(--muted); font-size: 11px; }

.catalog-list { display: grid; gap: 10px; }
.catalog-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 12px; border: 1px solid var(--line); }
.catalog-item img { width: 120px; height: 78px; object-fit: cover; background: var(--paper); }
.catalog-copy p { margin: 0 0 5px; color: var(--red); font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.catalog-copy h3 { margin: 0; font-size: 17px; }.catalog-copy span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.catalog-actions { display: grid; gap: 7px; }
.small-button { min-height: 31px; border: 1px solid var(--line); padding: 0 10px; background: #fff; font-size: 10px; font-weight: 800; }
.small-button:hover { border-color: var(--ink); }.small-button.danger { color: var(--bad); }.small-button.danger:hover { color: #fff; border-color: var(--bad); background: var(--bad); }
.publish-badge, .status-badge { display: inline-flex; align-items: center; min-height: 22px; border-radius: 999px; padding: 0 8px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.publish-badge.live, .status-badge.good { color: var(--good); background: #e6f6ef; }.publish-badge.draft, .status-badge.muted { color: var(--muted); background: #eee9e6; }.status-badge.warn { color: var(--warn); background: #fff1d8; }.status-badge.bad { color: var(--bad); background: #fde7e7; }

.device-layout { grid-template-columns: 390px minmax(0, 1fr); }
.search-heading { align-items: center; }.search-heading input { width: min(310px, 44%); }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 11px; }
th, td { padding: 12px 10px; border-bottom: 1px solid #eee7e3; text-align: left; vertical-align: top; }
th { color: var(--muted); background: #fbf8f6; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
td { line-height: 1.5; overflow-wrap: anywhere; }
.mac-code { font: 700 11px/1.4 Consolas, monospace; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; }
.records-card { min-height: 460px; }
.empty-row { padding: 40px 10px; color: var(--muted); text-align: center; }

.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; max-width: 420px; padding: 14px 18px; color: #fff; background: var(--ink); box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: none; }.toast.error { background: var(--bad); }.toast.success { background: var(--good); }

@media (max-width: 1100px) {
  .workspace-grid, .device-layout { grid-template-columns: 1fr; }
  .editor-card { position: static; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  .login-view { grid-template-columns: 1fr; }.login-art { display: none; }.login-card { width: calc(100% - 36px); }
  .header-inner, .admin-shell { width: calc(100% - 28px); }
  .header-inner { min-height: 64px; }.admin-brand.compact img { width: 120px; }.session-user, .header-link { display: none; }
  .admin-shell { padding-top: 38px; }
  .admin-title { align-items: stretch; flex-direction: column; gap: 22px; }.refresh-button { align-self: flex-start; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }.form-grid .wide { grid-column: auto; }
  .catalog-item { grid-template-columns: 86px 1fr; }.catalog-item img { width: 86px; height: 68px; }.catalog-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .card-heading.search-heading { align-items: stretch; flex-direction: column; }.search-heading input { width: 100%; }
  .toast { left: 14px; right: 14px; bottom: 14px; }
}
