/* B3 Team — employee training portal styles.
   Single stylesheet, no framework. Matches the warm/orange theme of the v5 demo. */

:root {
  --bg: #fef9f3;
  --surface: #ffffff;
  --surface-2: #fef3e8;
  --border: #e7e2d9;
  --border-strong: #d6cdc0;
  --text: #1a1410;
  --text-muted: #6b5f54;
  --text-faint: #a08570;
  --accent: #c2410c;
  --accent-2: #ea580c;
  --accent-soft: #fed7aa;
  --accent-soft-2: #fef3e8;
  --owner: #dc2626;
  --manager: #c2410c;
  --staff: #64748b;
  --good: #15803d;
  --good-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --sidebar-bg: #6b5645;       /* significantly lighter warm brown */
  --sidebar-border: #8c7864;
  --sidebar-text: #f7eeda;     /* high-contrast cream */
  --sidebar-faint: #dac9aa;
  --sidebar-active: #8c7864;
  --shadow-sm: 0 1px 2px rgba(28, 20, 16, 0.06);
  --shadow: 0 4px 14px rgba(28, 20, 16, 0.08);
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  margin: 0 0 .5em;
  color: var(--text);
}
h1 { font-size: 2.25rem; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
.serif { font-family: Georgia, "Times New Roman", serif; }

.eyebrow {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--accent);
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.subtitle { color: var(--text-muted); margin-top: .25rem; }

/* --- Layout shell ------------------------------------------------ */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

/* --- Mobile top bar (hidden on desktop) -------------------------- */
.mobile-bar { display: none; }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 49;
}

.sidebar .brand {
  padding: 18px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar .sidebar-logo { width: 56px; height: auto; flex-shrink: 0; }
.sidebar .brand .name { font-weight: 700; }
.sidebar .brand .tag { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-text); }
.mobile-bar .mobile-logo { width: 44px; height: auto; flex-shrink: 0; }

.sidebar .me {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px;
  color: #fff;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--sidebar-border);
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.sidebar .me:hover { background: rgba(0,0,0,.2); }
.sidebar .me .meta { min-width: 0; }
.sidebar .me .meta .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me .meta .role { font-size: 10px; text-transform: uppercase; color: var(--sidebar-text); letter-spacing: .08em; display: flex; align-items: center; gap: 4px; }

.sidebar nav { padding: 12px; overflow-y: auto; flex: 1; }
.sidebar .group-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-faint); padding: 12px 12px 6px; }
.sidebar .group-label.loc-header {
  display: flex; align-items: center; gap: 6px;
  color: #d1a96b;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 14px;
  margin-top: 6px;
}
.sidebar .group-label.loc-header .svg-icon { color: #d1a96b; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 14px; color: var(--sidebar-text);
  margin-bottom: 2px;
}
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.04); }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; }
.sidebar nav a .icon { width: 16px; flex-shrink: 0; }
.sidebar nav .loc-row { align-items: flex-start; padding: 8px 12px; }
.sidebar nav .loc-row .city { font-size: 10px; opacity: .7; display: block; }

.sidebar .signout {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar .signout a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 14px; color: var(--sidebar-text);
}
.sidebar .signout a:hover { color: #fff; }

.main {
  flex: 1;
  overflow-x: hidden;
}
.page {
  padding: 28px 32px;
  max-width: 1100px;
}

/* --- Avatars ----------------------------------------------------- */
.avatar {
  border-radius: 999px;
  display: grid; place-items: center;
  font-weight: 700; color: #fff;
  background: var(--staff);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.role-admin   { background: linear-gradient(135deg, #b8860b, #dab859); color: #1a1410; }
.avatar.role-owner   { background: var(--owner); }
.avatar.role-manager { background: var(--manager); }
.avatar.role-staff   { background: var(--staff); }
.avatar.s-32 { width: 32px; height: 32px; font-size: 11px; }
.avatar.s-36 { width: 36px; height: 36px; font-size: 12px; }
.avatar.s-40 { width: 40px; height: 40px; font-size: 13px; }
.avatar.s-44 { width: 44px; height: 44px; font-size: 14px; }
.avatar.s-96 { width: 96px; height: 96px; font-size: 28px; }

/* --- Cards / panels --------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card .card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card .card-body { padding: 22px; }
.card .card-footer {
  padding: 16px 22px;
  background: #faf6ee;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color .15s, box-shadow .15s;
}
.stat-card:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); color: var(--text); }
.stat-card .icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-soft-2); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 12px;
}
.stat-card .num { font-size: 1.85rem; font-weight: 800; line-height: 1; }
.stat-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-top: 6px; font-weight: 700; }

/* --- Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 700; font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: var(--surface);
  color: var(--text);
  transition: transform .05s, box-shadow .15s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
}
.btn-primary:hover { color: #fff; }
.btn-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--accent-soft-2); box-shadow: none; }
.btn-danger {
  background: #fee2e2; color: #991b1b; border-color: transparent;
}
.btn-danger:hover { background: #fecaca; color: #7f1d1d; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-icon { padding: 7px; width: 34px; justify-content: center; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- Forms ------------------------------------------------------- */
label.field-label {
  display: block;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, .15);
}
.textarea { resize: vertical; min-height: 110px; }
.input-with-icon { position: relative; }
.input-with-icon .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.input-with-icon .input, .input-with-icon .select { padding-left: 38px; }

.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 640px) {
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}

.pin-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 28px;
  letter-spacing: .8em;
  text-align: center;
  padding: 12px;
}

/* --- Alerts / flash --------------------------------------------- */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid transparent;
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 12px;
}
.alert-error  { background: var(--bad-soft); border-color: #fecaca; color: var(--bad); }
.alert-info   { background: var(--info-soft); border-color: #bfdbfe; color: var(--info); }
.alert-success{ background: var(--good-soft); border-color: #bbf7d0; color: var(--good); }
.alert-warn   { background: var(--warn-soft); border-color: #fde68a; color: var(--warn); }

/* --- Tables / rows ---------------------------------------------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-row { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: center; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #fff8ef; }
.list-empty { padding: 56px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }

/* --- Tags / pills ------------------------------------------------ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 3px 7px; border-radius: 5px;
  background: var(--accent-soft); color: #7c2d12;
}
.tag.role-admin   { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #5b4310; font-weight: 800; }
.tag.role-owner   { background: #fee2e2; color: #991b1b; }
.tag.role-manager { background: #fed7aa; color: #7c2d12; }
.tag.role-staff   { background: #e2e8f0; color: #475569; }
.tag.audience-manager { background: #fed7aa; color: #7c2d12; }
.tag.audience-staff   { background: #e2e8f0; color: #475569; }
.tag.access-on  { background: var(--good-soft); color: var(--good); }
.tag.access-off { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.tag.deactivated { background: #e2e8f0; color: #475569; }
.tag.files { background: var(--info-soft); color: var(--info); }
.tag.audit-created, .tag.audit-posted, .tag.audit-activated { background: var(--good-soft); color: var(--good); }
.tag.audit-deleted, .tag.audit-deactivated { background: var(--bad-soft); color: var(--bad); }
.tag.audit-updated { background: var(--info-soft); color: var(--info); }

/* --- Toggle switch ---------------------------------------------- */
.toggle-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: left; color: inherit;
  font: inherit;
}
/* Hide the actual checkbox visually but keep it interactive so the
   wrapping <label class="toggle-row"> still toggles it on click. */
.toggle-row > input[type="checkbox"].toggle-input {
  position: absolute; left: -9999px; opacity: 0;
}
.toggle-row.on,
.toggle-row:has(input.toggle-input:checked) {
  border-color: var(--accent); background: var(--accent-soft-2);
}
.toggle-row .ico-box { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #e2e8f0; color: #94a3b8; flex-shrink: 0; }
.toggle-row.on .ico-box,
.toggle-row:has(input.toggle-input:checked) .ico-box { background: var(--accent); color: #fff; }
.toggle-row .body { flex: 1; min-width: 0; }
.toggle-row .body .ttl { font-weight: 700; font-size: 13px; }
.toggle-row .body .desc { font-size: 12px; color: var(--text-muted); }
.toggle-row .switch { width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; flex-shrink: 0; transition: background .15s; }
.toggle-row .switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 999px; background: #fff;
  transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle-row.on .switch,
.toggle-row:has(input.toggle-input:checked) .switch { background: var(--accent); }
.toggle-row.on .switch::after,
.toggle-row:has(input.toggle-input:checked) .switch::after { left: 18px; }

/* --- Login page ------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #1a0a07 0%, #3d1810 50%, #6b2818 100%);
  position: relative;
  overflow: hidden;
}
.login-shell::before, .login-shell::after {
  content: ''; position: absolute; border-radius: 50%; opacity: .25;
  filter: blur(50px);
}
.login-shell::before { top: -60px; left: -60px; width: 320px; height: 320px; background: #f59e0b; }
.login-shell::after  { bottom: -80px; right: -80px; width: 420px; height: 420px; background: #dc2626; }
.login-card {
  position: relative; z-index: 2;
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.login-card .top {
  background: #000000;
  color: #fff;
  padding: 28px 32px;
  display: flex; align-items: center; gap: 12px;
}
.login-card .top.login-top-logo {
  justify-content: center;
  padding: 24px 24px 18px;
}
.login-card .login-logo { width: 200px; max-width: 80%; height: auto; display: block; }
.login-card .body { padding: 28px 32px 30px; }

/* --- Misc -------------------------------------------------------- */
.spacer-sm { height: 8px; }
.spacer    { height: 16px; }
.spacer-lg { height: 28px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
@media (max-width: 720px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
}
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- File upload zone ------------------------------------------- */
.upload-zone {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #fffaf2;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-soft-2); color: var(--accent); }
.file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: #faf6ee; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
}
.file-row .nm { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .sz { font-size: 11px; color: var(--text-muted); }

/* --- Schedule grid ---------------------------------------------- */
.schedule-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell {
  background: var(--surface); border: 2px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; min-height: 200px; overflow: hidden;
}
.day-cell.today { border-color: var(--accent); }
.day-cell .head { padding: 8px; text-align: center; background: #faf6ee; border-bottom: 1px solid var(--border); }
.day-cell.today .head { background: var(--accent-soft-2); border-color: var(--accent-soft); }
.day-cell .head .dow { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
.day-cell .head .num { font-size: 22px; font-weight: 800; }
.day-cell.today .head .num { color: var(--accent); }
.day-cell .body { padding: 6px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.shift-chip { padding: 6px 8px; border-radius: 6px; background: var(--accent-soft-2); border: 1px solid var(--accent-soft); font-size: 11px; position: relative; }
.shift-chip .t  { font-weight: 700; color: #7c2d12; }
.shift-chip .nm { color: var(--text-muted); }

/* --- SVG icons (tiny) -------------------------------------------- */
.svg-icon {
  width: 1em; height: 1em; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-16 { width: 16px; height: 16px; }
.icon-20 { width: 20px; height: 20px; }
.icon-24 { width: 24px; height: 24px; }

/* ===================================================================
   Mobile (≤ 900px)
   =================================================================== */
@media (max-width: 900px) {
  /* Sidebar slides in from the left, hidden by default */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100dvh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  /* Top bar with hamburger (mobile only) */
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--sidebar-bg);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--sidebar-border);
  }
  .mobile-bar .hamburger {
    background: none; border: 1px solid #3d2818;
    color: #fff; width: 36px; height: 36px;
    border-radius: 8px; display: grid; place-items: center;
    cursor: pointer; padding: 0;
  }
  .mobile-bar .hamburger:hover { background: rgba(255,255,255,.06); }
  .mobile-bar .brand-name { font-weight: 700; font-size: 14px; }
  .mobile-bar .brand-tag  { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-text); }

  /* Main content takes full width on mobile */
  .main { width: 100%; }
  .page { padding: 18px 14px; }

  /* Schedule: stack the seven day cells vertically */
  .schedule-grid { grid-template-columns: 1fr; gap: 8px; }
  .day-cell { min-height: auto; flex-direction: row; }
  .day-cell .head {
    border-right: 1px solid var(--border);
    border-bottom: none;
    width: 64px; flex-shrink: 0;
    display: flex; flex-direction: column; justify-content: center;
  }
  .day-cell.today .head { border-right-color: var(--accent-soft); }
  .day-cell .body { min-height: 50px; }

  /* Stat cards smaller padding */
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 1.5rem; }

  /* Cards / forms get less internal padding so things breathe on small screens */
  .card .card-header { padding: 14px 16px; }
  .card .card-body   { padding: 16px; }
  .card .card-footer { padding: 12px 16px; }

  h1 { font-size: 1.7rem; }

  /* List rows: action buttons wrap below the text */
  .list-row { padding: 14px 16px; flex-wrap: wrap; }
}

/* Tiny screens: extra-tight headings */
@media (max-width: 380px) {
  .page { padding: 14px 10px; }
  h1 { font-size: 1.5rem; }
  .login-card .top, .login-card .body { padding: 22px 20px; }
}
