/* admin.css — Stocketa admin portal. Same tokens as the desktop app
   (see DESIGN.md) so both products read as one brand: navy header with the
   reversed compact logo, Mist page, white cards, Inter for every number,
   one Action Green primary button per screen. */

:root {
  --navy: #13232F;
  --navy-700: #1C3242;
  --leaf: #41B546;
  --deep-green: #0E9060;
  --action: #0B7A50;
  --action-hover: #096A45;
  --mist: #F4F6F5;
  --white: #FFFFFF;
  --line: #DDE3E1;
  --border-strong: #7D8C95;
  --slate: #5B6B76;
  --on-navy-muted: #B7C2C9;
  --success: #0B7A50;
  --success-tint: #E3F2EA;
  --warning: #8A5A00;
  --warning-tint: #FBF0DA;
  --danger: #C93A3A;
  --danger-tint: #F8E1E1;
  --leaf-gradient: linear-gradient(135deg, #41B546 0%, #0E9060 100%);

  --font-heading: 'Montserrat', Arial, sans-serif;
  --font-body: 'Inter', Arial, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-card: 0 1px 2px rgba(19, 35, 47, 0.05);
  --shadow-pop: 0 16px 40px rgba(19, 35, 47, 0.18);

  /* Legacy names still used in inline styles in the PHP pages. */
  --ink-900: var(--navy);
  --ink-800: var(--navy-700);
  --paper: var(--mist);
  --paper-card: var(--white);
  --brass: var(--action);
  --brass-dark: var(--warning);
  --brass-light: var(--warning-tint);
  --green-ok: var(--success);
  --red-danger: var(--danger);
  --border: var(--line);
  --text-main: var(--navy);
  --text-muted: var(--slate);
  --font-display: var(--font-heading);
  --font-mono: var(--font-body);
  --radius: var(--r-sm);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--mist);
  color: var(--navy);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--action); }
a:hover { color: var(--action-hover); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-heading); color: var(--navy); }

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
  position: relative;
}
.login-body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--leaf-gradient);
}
.login-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 40px 32px 32px;
  width: 380px;
  max-width: 100%;
  box-shadow: var(--shadow-card);
}
.login-card .login-logo { display: block; width: 260px; max-width: 100%; height: auto; margin: 0 auto 32px; }
.login-card h1 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-card .login-sub { color: var(--slate); font-size: 14px; margin: 0 0 8px; }
.login-card label {
  display: block;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.login-card input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--navy);
}
.login-card input:focus { outline: 2px solid var(--action); outline-offset: 2px; border-color: var(--action); }
.login-card button { margin-top: 24px; width: 100%; min-height: 44px; }

/* ---------- Header bar ---------- */
.topbar {
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  height: 64px;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}
.topbar .brand img { height: 30px; width: auto; display: block; }
.topbar .brand .brand-tag {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-navy-muted);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.topbar .spacer { flex: 1; }
.topbar a:not(.brand) {
  color: var(--on-navy-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}
.topbar a:not(.brand):hover { color: var(--white); background: var(--navy-700); }

.content { max-width: 1200px; margin: 0 auto; padding: 32px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.page-header .subtitle { color: var(--slate); font-size: 14px; margin-top: 4px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: 24px;
  margin-bottom: 24px;
}
.card h2, .card h3 { font-weight: 700; }
.card:has(table.data-table) { overflow-x: auto; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  min-height: 38px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn-primary { background: var(--action); color: var(--white); }
.btn-primary:hover { background: var(--action-hover); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { background: var(--mist); color: var(--navy); border-color: #C9D2CF; }
.btn-danger { background: var(--white); color: var(--danger); border-color: #E8B4B4; }
.btn-danger:hover { background: var(--danger-tint); color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: var(--white); }
.btn-danger-solid:hover { background: #B03030; color: var(--white); }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 13px; }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table thead th {
  text-align: left;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate);
  background: var(--mist);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}
table.data-table thead th:first-child { border-top-left-radius: var(--r-sm); }
table.data-table thead th:last-child { border-top-right-radius: var(--r-sm); }
table.data-table tbody td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: #F8FAF9; }
table.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table .code { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--slate); }
table.data-table td:has(> .btn) { white-space: nowrap; }

/* ---------- Badges (always with a word) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--slate);
  white-space: nowrap;
}
.badge-ok { background: var(--success-tint); color: var(--success); }
.badge-warn { background: var(--warning-tint); color: var(--warning); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  margin-bottom: 16px;
  border-left: 4px solid currentColor;
}
.alert-error { background: var(--danger-tint); color: var(--danger); }
.alert-success { background: var(--success-tint); color: var(--success); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.span-2 { grid-column: span 2; }
.form-field label {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-field input, .form-field select, .form-field textarea {
  font-family: var(--font-body);
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--navy);
  background: var(--white);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: 2px solid var(--action);
  outline-offset: 2px;
  border-color: var(--action);
}

.detail-row { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: none; }
.detail-row .label {
  width: 180px;
  flex: 0 0 180px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 2px;
}
.detail-row .value { font-size: 15px; font-variant-numeric: tabular-nums; }

.code-display {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  background: var(--mist);
  border: 1px dashed var(--border-strong);
  padding: 14px 16px;
  border-radius: var(--r-sm);
  text-align: center;
  letter-spacing: 0.08em;
}

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(19, 35, 47, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--white); border-radius: var(--r-lg); width: 480px; max-width: 92vw; box-shadow: var(--shadow-pop); overflow: hidden; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--line); font-family: var(--font-heading); font-weight: 700; font-size: 18px; }
.modal-header.danger { color: var(--danger); }
.modal-body { padding: 24px; font-size: 15px; line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--mist); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--slate); }

/* ---------- Small screens ---------- */
@media (max-width: 768px) {
  .topbar { padding: 0 16px; }
  .topbar .brand img { height: 24px; }
  .content { padding: 24px 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-field.span-2 { grid-column: auto; }
  .detail-row { flex-direction: column; gap: 4px; }
  .detail-row .label { width: auto; flex: none; }
  .btn { min-height: 44px; }
}
