/* ── OpenZaiko Global Styles ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-office:      #0F6E56;
  --color-storekeeper: #185FA5;
  --color-supervisor:  #854F0B;
  --color-management:  #3C3489;
  --color-danger:      #C0392B;
  --color-warning:     #E67E22;
  --color-success:     #27AE60;
  --color-text:        #1A1A1A;
  --color-muted:       #6B7280;
  --color-border:      #D1D5DB;
  --color-bg:          #F4F6F8;
  --color-card:        #FFFFFF;
  --accent:            #0F6E56;  /* overridden per role via body class */
  --radius:            8px;
  --shadow:            0 1px 4px rgba(0,0,0,0.08);
}

body.role-office      { --accent: var(--color-office); }
body.role-storekeeper { --accent: var(--color-storekeeper); }
body.role-supervisor  { --accent: var(--color-supervisor); }
body.role-management  { --accent: var(--color-management); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* ── Top Nav ─────────────────────────────────────────────────────────────── */
.topnav {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.topnav__brand { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.topnav__meta  { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.topnav__left  { display: flex; flex-direction: column; }
.topnav__right { display: flex; align-items: center; gap: 16px; }

/* Bell notification */
.bell-btn {
  background: none; border: none; cursor: pointer;
  color: #fff; position: relative; font-size: 20px;
  padding: 8px; border-radius: 50%;
  transition: background 0.15s;
}
.bell-btn:hover { background: rgba(255,255,255,0.15); }
.bell-badge {
  position: absolute; top: 2px; right: 2px;
  background: #EF4444; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 10px; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.bell-badge.hidden { display: none; }

.logout-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Sidebar / Nav links ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--color-border);
  padding: 16px 0; flex-shrink: 0;
}
.sidebar a {
  display: block; padding: 11px 20px;
  color: var(--color-text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(0,0,0,0.04);
  color: var(--accent);
  border-left-color: var(--accent);
}

.main { flex: 1; padding: 24px 20px; max-width: 1100px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card__title {
  font-size: 15px; font-weight: 700;
  color: var(--accent); margin-bottom: 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--color-border);
}

/* Summary cards row */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.summary-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  border-top: 3px solid var(--accent);
}
.summary-card__label { font-size: 12px; color: var(--color-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.summary-card__value { font-size: 28px; font-weight: 800; color: var(--color-text); margin-top: 4px; }
.summary-card--danger  { border-top-color: var(--color-danger); }
.summary-card--warning { border-top-color: var(--color-warning); }
.summary-card--success { border-top-color: var(--color-success); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 12px;
  background: #F9FAFB; color: var(--color-muted);
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; border-bottom: 2px solid var(--color-border);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--color-border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFAFA; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--color-muted); }
input, select, textarea {
  width: 100%; padding: 11px 12px;
  border: 1.5px solid var(--color-border); border-radius: 6px;
  font-size: 14px; color: var(--color-text);
  background: #fff; transition: border-color 0.15s;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
}
textarea { min-height: 80px; resize: vertical; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px;
  border-radius: 6px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; min-height: 44px;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary   { background: var(--accent); color: #fff; }
.btn--primary:hover { opacity: 0.9; }
.btn--danger    { background: var(--color-danger); color: #fff; }
.btn--outline   { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn--sm        { padding: 7px 14px; font-size: 13px; min-height: 36px; }
.btn--full      { width: 100%; }

/* ── Badges / Status ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 700;
}
.badge--pending  { background: #FEF3C7; color: #92400E; }
.badge--released { background: #D1FAE5; color: #065F46; }
.badge--partial  { background: #DBEAFE; color: #1E40AF; }
.badge--ordered  { background: #EDE9FE; color: #4C1D95; }
.badge--received { background: #D1FAE5; color: #065F46; }
.badge--short    { background: #FEE2E2; color: #991B1B; }
.badge--done     { background: #D1FAE5; color: #065F46; }
.badge--urgent   { background: #FEE2E2; color: #991B1B; }
.badge--normal   { background: #F3F4F6; color: #374151; }
.badge--low      { background: #FEE2E2; color: #991B1B; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 6px;
  font-size: 14px; margin-bottom: 14px;
  display: none;
}
.alert.show { display: block; }
.alert--success { background: #D1FAE5; color: #065F46; border-left: 4px solid #059669; }
.alert--error   { background: #FEE2E2; color: #991B1B; border-left: 4px solid #DC2626; }
.alert--warn    { background: #FEF3C7; color: #92400E; border-left: 4px solid #D97706; }

/* ── Notifications panel ─────────────────────────────────────────────────── */
.notif-panel {
  position: fixed; top: 56px; right: 0;
  width: 340px; max-height: calc(100vh - 56px);
  background: #fff; border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
  overflow-y: auto; z-index: 200;
  display: none; flex-direction: column;
}
.notif-panel.open { display: flex; }
.notif-panel__header {
  padding: 14px 16px; font-weight: 700; font-size: 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: #fff;
}
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid #F3F4F6;
  cursor: pointer; transition: background 0.1s;
}
.notif-item:hover { background: #F9FAFB; }
.notif-item.unread { background: #EFF6FF; }
.notif-item__msg   { font-size: 13px; line-height: 1.4; }
.notif-item__time  { font-size: 11px; color: var(--color-muted); margin-top: 4px; }

/* ── Urgency highlight ───────────────────────────────────────────────────── */
.urgent-row td { background: #FFF9F9; }
.low-stock-row td { background: #FFF9F9; }
td.low { color: var(--color-danger); font-weight: 700; }

/* ── Qty controls ────────────────────────────────────────────────────────── */
.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control input { width: 80px; text-align: center; }
.qty-btn {
  width: 36px; height: 36px; border: 1.5px solid var(--color-border);
  border-radius: 6px; background: #fff; font-size: 18px;
  cursor: pointer; font-weight: 700; display: flex;
  align-items: center; justify-content: center;
  color: var(--accent);
}
.qty-btn:hover { background: #F3F4F6; }

/* ── Change password forced modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff; border-radius: 10px;
  padding: 28px; width: 90%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal__title { font-size: 17px; font-weight: 700; margin-bottom: 16px; color: var(--color-danger); }

/* ── Page title ──────────────────────────────────────────────────────────── */
.page-title {
  font-size: 20px; font-weight: 800; color: var(--color-text);
  margin-bottom: 20px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--color-border); margin-bottom: 20px; }
.tab-btn {
  padding: 9px 18px; background: none; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--color-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0F6E56 0%, #185FA5 100%);
}
.login-box {
  background: #fff; border-radius: 12px;
  padding: 36px 32px; width: 90%; max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-logo {
  text-align: center; margin-bottom: 8px;
  font-size: 26px; font-weight: 900; color: var(--color-office);
  letter-spacing: -0.5px;
}
.login-sub {
  text-align: center; font-size: 12px;
  color: var(--color-muted); margin-bottom: 28px;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .sidebar { display: none; }
  .main { padding: 16px 12px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .notif-panel { width: 100%; }
  .topnav__brand { font-size: 16px; }
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--color-muted); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-right   { text-align: right; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-8  { margin-bottom: 8px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
