@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --nav-h:      58px;

  /* Gloster brand */
  --red:        #C8362A;
  --red-dark:   #A52620;
  --red-lt:     #FEF2F0;

  /* Nav / dark surfaces */
  --navy:       #1C2333;
  --navy-dark:  #111827;

  /* Grays */
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-300:   #cbd5e1;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-800:   #1e293b;
  --white:      #ffffff;

  /* Status */
  --green:      #10b981;
  --amber:      #f59e0b;
  --blue:       #3b82f6;
  --purple:     #8b5cf6;
  --teal:       #14b8a6;

  --radius:     8px;
  --radius-lg:  12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.10);
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--navy-dark) 0%, var(--navy) 60%, #2b1a18 100%);
}
.login-card {
  background: var(--white); border-radius: 16px;
  padding: 44px 40px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 72px; width: auto; object-fit: contain; }
.login-logo p { font-size: 12px; color: var(--gray-400); margin-top: 8px; letter-spacing: .3px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 5px; letter-spacing: .2px; text-transform: uppercase; }
.login-card input { width: 100%; padding: 10px 13px; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s; }
.login-card input:focus { border-color: var(--red); }
.btn-primary { width: 100%; padding: 11px; background: var(--red); color: var(--white); border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background .15s; margin-top: 4px; }
.btn-primary:hover { background: var(--red-dark); }
.error-msg { color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; min-height: 18px; }

/* ── Top Navigation ─────────────────────────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--navy);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 6px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  margin-right: 24px; flex-shrink: 0;
}
.nav-brand img { height: 34px; width: auto; object-fit: contain; }
.nav-brand-text { line-height: 1; }
.nav-brand-text h2 { font-size: 13px; font-weight: 700; color: var(--white); }
.nav-brand-text p  { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 2px; }

.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }

.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.65);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none; background: none; font-family: inherit;
  white-space: nowrap;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: var(--white); }
.nav-link.active { background: rgba(200,54,42,.25);   color: var(--white); }
.nav-link svg    { flex-shrink: 0; opacity: .8; }
.nav-link.active svg { opacity: 1; }

.nav-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,.1);
}
.nav-user { font-size: 12px; color: rgba(255,255,255,.55); white-space: nowrap; }
.logout-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.07); border: none;
  color: rgba(255,255,255,.6);
  font-size: 12px; font-family: inherit; font-weight: 500;
  cursor: pointer; padding: 6px 10px; border-radius: 6px;
  transition: all .15s;
}
.logout-btn:hover { background: rgba(255,255,255,.12); color: var(--white); }

/* ── Main content ────────────────────────────────────────────────────────────── */
.main {
  padding: calc(var(--nav-h) + 24px) 28px 28px;
  min-height: 100vh;
}

.page-header { margin-bottom: 20px; display: flex; align-items: baseline; gap: 10px; }
.page-header h1 { font-size: 19px; font-weight: 700; color: var(--gray-800); }
.page-header p  { font-size: 13px; color: var(--gray-400); }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; }

/* ── Stat cards ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 1280px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.red    { background: #fde8e6; color: var(--red); }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.teal   { background: #ccfbf1; color: #0d9488; }

.stat-body { min-width: 0; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gray-800); line-height: 1; }
.stat-label { font-size: 11px; color: var(--gray-400); margin-top: 3px; white-space: nowrap; }

/* ── Two-col grid ────────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ── Module card ─────────────────────────────────────────────────────────────── */
.module-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.module-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.module-icon.red  { background: #fde8e6; color: var(--red); }
.module-icon.amber{ background: #fef3c7; color: #d97706; }
.module-body { flex: 1; min-width: 0; }
.module-body h3   { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.module-body p    { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.enabled  { background: #d1fae5; color: #065f46; }
.badge.disabled { background: #fee2e2; color: #991b1b; }

/* ── Upload ─────────────────────────────────────────────────────────────────── */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .upload-grid { grid-template-columns: 1fr; } }

.upload-card { background: var(--white); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); }
.upload-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.upload-card p.sub { font-size: 12px; color: var(--gray-400); margin-bottom: 16px; }

.upload-zone {
  border: 2px dashed var(--gray-200); border-radius: var(--radius);
  padding: 24px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s; margin-bottom: 12px;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--red); background: var(--red-lt); }
.upload-zone .uz-icon { color: var(--gray-300); margin-bottom: 8px; }
.upload-zone p { font-size: 12px; color: var(--gray-400); line-height: 1.6; }
.upload-zone p span { color: var(--red); font-weight: 600; cursor: pointer; }
.upload-zone input[type=file] { display: none; }
.file-name { font-size: 12px; color: var(--gray-600); margin-bottom: 10px; min-height: 18px; }

.btn-upload { width: 100%; padding: 9px; background: var(--red); color: var(--white); border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background .15s; }
.btn-upload:hover    { background: var(--red-dark); }
.btn-upload:disabled { opacity: .4; cursor: not-allowed; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 0; border-top: 1px solid var(--gray-100); margin-top: 14px; }
.toggle-row .tl { }
.toggle-row label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.toggle-row small { display: block; font-size: 11px; color: var(--gray-400); margin-top: 1px; }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-200); border-radius: 22px; cursor: pointer; transition: background .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: transform .2s; }
.toggle input:checked + .toggle-slider { background: var(--red); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.upload-result { font-size: 12px; min-height: 18px; margin-top: 8px; font-weight: 500; }
.upload-result.ok  { color: var(--green); }
.upload-result.err { color: var(--red); }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--red-lt); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill.voice  { background: #ede9fe; color: #6d28d9; }
.pill.text   { background: #dbeafe; color: #1d4ed8; }
.pill.stock  { background: #d1fae5; color: #065f46; }
.pill.hold   { background: #fef3c7; color: #92400e; }
.response-cell { max-width: 280px; white-space: pre-wrap; word-break: break-word; color: var(--gray-600); }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { padding: 7px 11px; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 13px; font-family: inherit; outline: none; background: var(--white); }
.filters select:focus, .filters input:focus { border-color: var(--red); }

.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; justify-content: flex-end; }
.pagination button { padding: 5px 12px; border: 1.5px solid var(--gray-200); background: white; border-radius: 6px; font-size: 12px; font-family: inherit; cursor: pointer; transition: all .12s; }
.pagination button:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.pagination button.active { background: var(--red); color: white; border-color: var(--red); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination span { font-size: 12px; color: var(--gray-400); margin-right: 4px; }

/* ── Settings ───────────────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

.settings-section { background: var(--white); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); }
.settings-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; gap: 7px; color: var(--gray-800); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: var(--gray-500, #64748b); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .2px; }
.form-group input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 13px; font-family: monospace; outline: none; transition: border-color .15s; }
.form-group input:focus { border-color: var(--red); }
.btn-save { padding: 9px 20px; background: var(--red); color: white; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background .15s; }
.btn-save:hover { background: var(--red-dark); }
.save-result { font-size: 12px; margin-top: 10px; font-weight: 500; min-height: 18px; }
.save-result.ok  { color: var(--green); }
.save-result.err { color: var(--red); }

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.text-muted  { color: var(--gray-400); font-size: 12px; }
.loading     { text-align: center; padding: 32px; color: var(--gray-400); font-size: 13px; }
