/* =====================================================================
   Coal Forum CMS — Admin UI (premium dark dashboard)
   Refreshed 2026: motion tokens, elevation, micro-interactions,
   accessible focus, refined tables & controls.
   ===================================================================== */
*,*::before,*::after { box-sizing: border-box; }

:root {
  --bg-0: #090b0f;
  --bg-1: #10131a;
  --bg-2: #161a23;
  --bg-3: #1f2430;
  --bg-4: #272d3b;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.13);
  --ink-1: #f2f4f8;
  --ink-2: #c8ccd6;
  --ink-3: #8b91a0;
  --ink-4: #5b6072;
  --gold: #c9a449;
  --gold-2: #e2c577;
  --gold-d: #8a6b1f;
  --green: #4caf78;
  --green-l: #7ed4a6;
  --red: #e26a3c;
  --red-l: #ec9374;
  --blue: #4a7fff;
  --blue-l: #8ba8ff;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 16px;

  --sidebar-w: 260px;

  /* Motion */
  --dur-fast: 130ms;
  --dur: 200ms;
  --dur-slow: 380ms;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);

  /* Elevation */
  --sh-1: 0 1px 2px rgba(0,0,0,.25);
  --sh-2: 0 6px 18px rgba(0,0,0,.30);
  --sh-3: 0 18px 44px rgba(0,0,0,.45);
  --glow-gold: 0 8px 28px rgba(201,164,73,.28);
}

html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink-2);
  background: var(--bg-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--gold-2); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--gold); }

::selection { background: rgba(201,164,73,.28); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid var(--bg-1); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* Accessible focus for keyboard users everywhere */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}
:focus:not(:focus-visible) { outline: none; }

/* ------- Sidebar ------- */
.admin-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 50;
}
.admin-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-1);
  font-weight: 600;
  transition: background var(--dur) var(--ease);
}
.admin-brand img { transition: transform var(--dur-slow) var(--ease-spring); }
.admin-brand:hover img { transform: rotate(-8deg) scale(1.06); }
.admin-brand small { color: var(--ink-3); font-weight: 400; font-size: 11px; }
.admin-brand:hover { color: var(--ink-1); }

.admin-nav { flex: 1; overflow-y: auto; padding: 16px 0; }
.nav-group { padding: 0 12px 4px; }
.nav-group-title {
  padding: 16px 12px 8px;
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 700;
}
.admin-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  color: var(--ink-2);
  border-radius: var(--r);
  font-size: 13.5px;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              padding var(--dur) var(--ease-out);
  margin-bottom: 2px;
}
.admin-nav a:hover { background: var(--bg-2); color: var(--ink-1); padding-left: 16px; }
.admin-nav a.is-active {
  background: linear-gradient(90deg, rgba(201,164,73,.16), rgba(201,164,73,.03));
  color: var(--gold-2);
  position: relative;
  font-weight: 600;
}
.admin-nav a.is-active::before {
  content: '';
  position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px rgba(201,164,73,.6);
}

.admin-user {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.user-info { flex: 1; line-height: 1.3; min-width: 0; }
.user-info strong { display: block; color: var(--ink-1); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { color: var(--ink-3); font-size: 11px; }
.user-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--bg-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 14px;
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.user-link:hover { color: var(--gold); background: var(--bg-1); transform: translateY(-2px); }
.user-link:active { transform: translateY(0) scale(.94); }

/* ------- Main ------- */
.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 0;
}
.admin-header {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px;
  background: rgba(16,19,26,.82);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.admin-menu-toggle {
  display: none;
  background: var(--bg-3); border: 0; color: var(--ink-1);
  width: 38px; height: 38px; border-radius: var(--r-sm); font-size: 18px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.admin-menu-toggle:hover { background: var(--bg-4); }
.admin-menu-toggle:active { transform: scale(.92); }
.admin-title {
  flex: 1; margin: 0;
  font-size: 22px; font-weight: 700; color: var(--ink-1);
  letter-spacing: -.01em;
}
.lang-pills {
  display: flex; gap: 4px;
  padding: 4px; background: var(--bg-2); border-radius: 999px; border: 1px solid var(--line);
}
.lang-pills a {
  padding: 6px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  color: var(--ink-3);
  border-radius: 999px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.lang-pills a:hover { color: var(--ink-1); }
.lang-pills a.is-active { background: var(--gold); color: var(--bg-0); }

.admin-content { padding: 32px; max-width: 1440px; }

/* Subtle entrance for content on load.
   Opacity-only on purpose: a translate/transform on .card (even after the
   animation settles) becomes the containing block for the table's
   `position: sticky` <thead> and breaks it. The lift motion instead lives on
   an inner wrapper (.card-rise) that never contains a sticky element. */
@media (prefers-reduced-motion: no-preference) {
  .admin-content > * { animation: fadeIn var(--dur-slow) var(--ease-out) both; }
  .admin-content > *:nth-child(2) { animation-delay: .05s; }
  .admin-content > *:nth-child(3) { animation-delay: .1s; }
  .admin-content > *:nth-child(4) { animation-delay: .15s; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
}

/* ------- Cards ------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--sh-1);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.card-header h2, .card-header h3 { margin: 0; font-size: 18px; color: var(--ink-1); font-weight: 600; display: flex; align-items: center; gap: 10px; }

/* ------- Toolbar (filters + actions row) ------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: 100%;
}
.toolbar .toolbar-title { margin: 0; font-size: 18px; color: var(--ink-1); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.toolbar .toolbar-spacer { margin-left: auto; }
.toolbar form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }

/* ------- KPI ------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  position: relative; overflow: hidden;
  box-shadow: var(--sh-1);
  transition: transform var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.kpi::after {
  content: ''; position: absolute; inset: 0 auto auto 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
  opacity: .5; transition: opacity var(--dur) var(--ease);
}
.kpi:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: var(--sh-2); }
.kpi:hover::after { opacity: 1; }
.kpi-label { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.kpi-value {
  font-size: 36px; font-weight: 700; color: var(--ink-1);
  line-height: 1; margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.kpi-delta { font-size: 12px; color: var(--green); }
.kpi-delta.is-neg { color: var(--red); }
.kpi-icon {
  position: absolute; right: 20px; top: 20px;
  width: 42px; height: 42px;
  background: rgba(201,164,73,.1);
  border: 1px solid rgba(201,164,73,.18);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: transform var(--dur) var(--ease-spring), background var(--dur) var(--ease);
}
.kpi:hover .kpi-icon { transform: scale(1.08) rotate(-4deg); background: rgba(201,164,73,.16); }

/* ------- Tables ------- */
.table-wrap { overflow-x: auto; border-radius: var(--r); }
table.data {
  width: 100%; border-collapse: collapse;
}
table.data th, table.data td {
  padding: 13px 14px; text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  vertical-align: middle;
}
table.data thead th {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
  background: var(--bg-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-2);
}
table.data thead th:first-child { border-top-left-radius: var(--r); }
table.data thead th:last-child { border-top-right-radius: var(--r); }
table.data tbody tr { transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
table.data tbody tr:hover {
  background: linear-gradient(90deg, rgba(201,164,73,.06), rgba(201,164,73,.015));
  box-shadow: inset 3px 0 0 var(--gold);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.actions { width: 1%; white-space: nowrap; }
table.data td strong { color: var(--ink-1); font-weight: 600; }
table.data a.rowmail { font-size: 12px; color: var(--ink-3); }
table.data a.rowmail:hover { color: var(--gold-2); }

/* Status changer <select> inside a table row */
.status-select {
  appearance: none;
  width: auto; min-width: 140px;
  padding: 7px 30px 7px 12px;
  background-color: var(--bg-0);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23c9a449' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink-1);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.status-select:hover { border-color: var(--gold-d); background-color: var(--bg-1); }
.status-select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,164,73,.14); }

.row-hint { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11px; color: var(--ink-4); }

/* ------- Forms ------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field-row--3 { grid-template-columns: repeat(3, 1fr); }
.field label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
}
.field label .req { color: var(--red); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--ink-1);
  font-family: inherit; font-size: 14px;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold); background: var(--bg-1);
  box-shadow: 0 0 0 3px rgba(201,164,73,.14);
}
.input::placeholder { color: var(--ink-4); }
.textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23c9a449' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.input--sm, .select--sm { padding: 7px 12px; font-size: 13px; }
.select--sm { padding-right: 30px; background-position: right 11px center; }
.help { font-size: 12px; color: var(--ink-4); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }

/* ------- Buttons ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  background: var(--bg-3); color: var(--ink-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); color: var(--ink-1); transform: translateY(-1px); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
.btn--primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold-d));
  border-color: transparent; color: #241b06; font-weight: 600;
}
.btn--primary:hover { color: #241b06; transform: translateY(-2px); box-shadow: var(--glow-gold); }
.btn--primary:active { transform: translateY(0) scale(.97); }
.btn--danger { background: rgba(226,106,60,.14); color: var(--red-l); border-color: rgba(226,106,60,.32); }
.btn--danger:hover { background: rgba(226,106,60,.24); color: #fff; border-color: rgba(226,106,60,.5); }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--bg-2); }
.btn-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Square icon button for table row actions */
.btn--icon {
  width: 34px; height: 34px; padding: 0; font-size: 15px;
  background: var(--bg-3); border: 1px solid var(--line);
}
.btn--icon.btn--danger { background: rgba(226,106,60,.12); }

/* ------- Badges ------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 11px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  border-radius: 999px;
  background: var(--bg-3); color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--ok { background: rgba(76,175,120,.16); color: var(--green-l); border-color: rgba(76,175,120,.22); }
.badge--warn { background: rgba(226,106,60,.16); color: var(--red-l); border-color: rgba(226,106,60,.22); }
.badge--info { background: rgba(74,127,255,.16); color: var(--blue-l); border-color: rgba(74,127,255,.22); }
.badge--gold { background: rgba(201,164,73,.16); color: var(--gold-2); border-color: rgba(201,164,73,.24); }
.badge--neutral { background: var(--bg-3); color: var(--ink-3); }
.badge--danger { background: rgba(226,106,60,.16); color: var(--red-l); border-color: rgba(226,106,60,.22); }

/* Count chip next to a heading */
.count-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 8px;
  font-size: 12px; font-weight: 700;
  border-radius: 999px;
  background: rgba(201,164,73,.14); color: var(--gold-2);
  border: 1px solid rgba(201,164,73,.22);
}

/* ------- Flash ------- */
.flash {
  margin: 20px 32px 0;
  padding: 14px 18px;
  border-radius: var(--r);
  border: 1px solid;
  font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
@media (prefers-reduced-motion: no-preference) {
  .flash { animation: flashIn var(--dur-slow) var(--ease-out) both; }
  @keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
}
.flash--success { background: rgba(76,175,120,.1); border-color: rgba(76,175,120,.3); color: #b8eccc; }
.flash--error   { background: rgba(226,106,60,.1); border-color: rgba(226,106,60,.3); color: #f1b59a; }
.flash--info    { background: rgba(74,127,255,.1); border-color: rgba(74,127,255,.3); color: #b3c7ff; }

/* ------- Login ------- */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(201,164,73,.18), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(74,127,255,.1), transparent 50%),
    var(--bg-0);
  padding: 40px 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--sh-3);
}
.login-logo {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  margin-bottom: 32px;
}
.login-card h1 {
  text-align: center;
  font-size: 22px; color: var(--ink-1); margin: 0 0 8px;
  font-family: 'Playfair Display', serif;
}
.login-card .sub { text-align: center; color: var(--ink-3); margin-bottom: 32px; font-size: 14px; }

/* ------- Tab pills ------- */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 16px; cursor: pointer; color: var(--ink-3); border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.tab:hover { color: var(--ink-1); }
.tab.is-active { color: var(--gold-2); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ------- Image preview ------- */
.thumb {
  width: 60px; height: 60px;
  border-radius: 8px;
  background: var(--bg-3);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: transform var(--dur-fast) var(--ease-spring), border-color var(--dur-fast) var(--ease);
}
.thumb:hover { transform: scale(1.08); border-color: var(--gold-d); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------- Empty state ------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-3);
  background: var(--bg-2);
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-2);
}

/* ------- Dimming overlay (mobile sidebar) ------- */
.admin-overlay {
  position: fixed; inset: 0;
  background: rgba(4,6,9,.6);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  z-index: 45;
}
body.sidebar-open .admin-overlay { opacity: 1; visibility: visible; }

/* =====================================================================
   RESPONSIVE — desktop · laptop · tablet · mobile · small phone
   ===================================================================== */

/* Laptop: slightly slimmer sidebar + tighter content */
@media (max-width: 1280px) {
  :root { --sidebar-w: 232px; }
  .admin-content { padding: 28px; }
  .admin-header { padding: 16px 28px; }
}

/* Tablet landscape: collapse sidebar to an off-canvas drawer */
@media (max-width: 1024px) {
  .admin-sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.2,.7,.2,1);
    box-shadow: 0 0 60px rgba(0,0,0,.5);
  }
  body.sidebar-open .admin-sidebar { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  table.data thead th { top: 71px; }
}

/* Tablet portrait */
@media (max-width: 860px) {
  .admin-header { padding: 14px 20px; gap: 12px; }
  .admin-title { font-size: 18px; }
  .admin-content { padding: 20px; }
  .flash { margin: 16px 20px 0; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .kpi { padding: 18px; }
  .kpi-value { font-size: 28px; }
  .field-row, .field-row--3 { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .card-header { flex-wrap: wrap; }
}

/* Phone */
@media (max-width: 600px) {
  .admin-sidebar { width: min(86vw, 300px); }
  .admin-header {
    padding: 12px 16px;
    position: sticky; top: 0;
  }
  .admin-title { font-size: 16px; }
  .admin-content { padding: 16px 14px; }
  .flash { margin: 14px 14px 0; padding: 12px 14px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 16px; }
  .kpi-label { font-size: 10px; margin-bottom: 8px; }
  .kpi-value { font-size: 24px; }
  .kpi-icon { width: 32px; height: 32px; font-size: 16px; right: 14px; top: 14px; }

  .card { padding: 16px; border-radius: var(--r); margin-bottom: 16px; }
  .card-header h2, .card-header h3 { font-size: 16px; }

  /* Tables scroll horizontally instead of breaking layout. */
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 560px; }
  table.data thead th { position: static; top: auto; }
  table.data th, table.data td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }

  .btn { padding: 9px 14px; }
  .btn-bar { gap: 6px; }
  .btn-bar .btn { flex: 1 1 auto; justify-content: center; }

  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }

  .lang-pills a { padding: 5px 10px; }

  .login-card { padding: 28px 22px; }
}

/* Small phone */
@media (max-width: 380px) {
  .admin-content { padding: 14px 10px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .admin-title { font-size: 15px; }
  .table-wrap { margin: 0 -10px; padding: 0 10px; }
  .login-card { padding: 24px 18px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Dashboard preview widgets are short — sticky header disabled here only */
table.data.data--static thead th { position: static !important; top: auto !important; }
