/* ============================================================================
   Cub Pharmacy Rosemount #1651 — shared stylesheet
   "Modern Dashboard", refined. Design tokens are seeded from the actual
   Cub Pharmacy logo (static/cub-logo.png): primary blue #0F56A0, red #E11D26.
   Pages reference tokens by name, never raw hex.
   ========================================================================== */

:root {
  /* Brand — sampled from the Cub logo */
  --color-primary:        #0F56A0;   /* Cub blue — headers, primary actions, focus */
  --color-primary-dark:   #0A3E73;   /* hover / pressed */
  --color-primary-tint:   rgba(15, 86, 160, 0.12);  /* focus ring / soft fills */
  --color-primary-bg:     #eef4fb;   /* subtle blue surface (row hover) */
  --color-primary-soft:   #e4eefa;   /* icon chips, soft accents */

  --color-danger:         #E11D26;   /* Cub red (logo #F02B30, deepened for white text) */
  --color-danger-dark:    #B31329;
  --color-danger-tint:    #fde8ea;

  --color-success:        #166534;
  --color-success-dark:   #14532d;
  --color-success-tint:   #dcfce7;

  --color-pending:        #b45309;
  --color-pending-bg:     #fef5e0;
  --color-pending-border: #f59e0b;

  --color-info:           #1d4ed8;   /* secondary blue, kept distinct from primary */
  --color-info-dark:      #1e40af;

  /* Neutrals */
  --color-heading:        #14171c;   /* darkest — headings, key numbers */
  --color-text:           #2a2d34;
  --color-muted:          #6b7280;
  --color-muted-dark:     #4b5563;
  --color-border:         #cdd2da;
  --color-border-light:   #e7eaef;
  --color-surface:        #ffffff;
  --color-surface-2:      #f7f9fc;   /* table headers, inset panels */
  --color-bg:             #f3f5f9;

  /* Type & shape */
  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --radius:        10px;
  --radius-sm:     7px;
  --radius-pill:   999px;
  --radius-lg:     16px;

  --shadow-sm:     0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-card:   0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 12px rgba(16, 24, 40, 0.05);
  --shadow-md:     0 2px 4px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.07);
  --shadow-lg:     0 14px 40px rgba(16, 24, 40, 0.14);
  --shadow-header: 4px 0 24px rgba(10, 36, 70, 0.18);
  --ring:          0 0 0 3px var(--color-primary-tint);

  /* Dashboard shell */
  --sidebar-width:  248px;
  --color-stripe:   #fafbfd;   /* zebra row */
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

svg { display: block; }
::selection { background: var(--color-primary-tint); }

/* ---- App shell: sidebar + main ------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

/* Mobile-only hamburger; hidden on desktop where the sidebar is always shown. */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 42px; height: 42px; margin: 0; padding: 0;
  background: rgba(255, 255, 255, 0.14); border: none; border-radius: 10px;
  color: #fff; cursor: pointer;
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.22); }
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle { position: relative; }

/* Task badges: a count on the mobile hamburger, a dot on nav items. */
.nav-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--color-danger, #e11d26);
  color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.sidebar-nav a .task-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ff5a5f;
  margin-left: auto; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,90,95,0.22);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255,255,255,0.10), transparent 60%),
    linear-gradient(178deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  box-shadow: var(--shadow-header);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px 18px;
  z-index: 100;
}

/* Brand lockup: red Cub mark in a rounded panel + white wordmark. */
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; margin-bottom: 22px; padding: 2px;
}
.brand-mark {
  flex-shrink: 0; width: 54px; height: 54px;
  background: #fff; border-radius: 15px; padding: 6px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(10, 36, 70, 0.28);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name {
  color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -0.01em;
}
.brand-store {
  display: flex; align-items: center; gap: 6px;
  margin-top: 3px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}
.brand-store::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: #5ee08a; box-shadow: 0 0 0 3px rgba(94, 224, 138, 0.22);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
  padding: 0 12px;
  margin: 6px 0 7px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.84);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: background-color 0.16s, color 0.16s;
}
.sidebar-nav a .ico {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: 0.92;
}
.sidebar-nav a .ico svg { width: 18px; height: 18px; }
.sidebar-nav a:hover { background-color: rgba(255, 255, 255, 0.13); color: #fff; }
.sidebar-nav a.is-active {
  background-color: #fff;
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(10, 36, 70, 0.22);
}
.sidebar-nav a.is-active .ico { opacity: 1; }

.sidebar-footer { margin-top: auto; padding-top: 16px; }
.sidebar-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background-color: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.16s, color 0.16s;
}
.sidebar-footer a svg { width: 16px; height: 16px; }
.sidebar-footer a:hover { background-color: var(--color-danger); color: #fff; }

.app-main { flex: 1; min-width: 0; }

/* ---- Layout ------------------------------------------------------------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 38px 64px;
}
.page--narrow { max-width: 680px; }
.page--wide   { max-width: 1520px; }

.container {
  background-color: var(--color-surface);
  padding: 28px 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-light);
}

/* Page header — icon chip + title (replaces emoji-in-h1) */
.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.page-head--tight { margin-bottom: 18px; }
.page-head-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.page-head-icon svg { width: 23px; height: 23px; }
.page-head h1 { margin: 0; }
.page-sub { font-size: 13.5px; color: var(--color-muted); margin-top: 2px; }

h1 {
  color: var(--color-heading);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 18px;
}

.logged-in-as {
  font-size: 13px;
  color: var(--color-muted);
  text-align: right;
  margin-bottom: 10px;
}
.logged-in-as strong { color: var(--color-text); }

/* ---- Stat cards (dashboard summary) ------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 15px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.18s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.stat-icon svg { width: 23px; height: 23px; }
.stat-card .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--color-heading);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.stat-card .lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 7px;
}
.stat-card.is-pending  .stat-icon { background: var(--color-pending-bg);  color: var(--color-pending); }
.stat-card.is-approved .stat-icon { background: var(--color-success-tint); color: var(--color-success); }
.stat-card.is-denied   .stat-icon { background: var(--color-danger-tint);  color: var(--color-danger); }

/* ---- Forms -------------------------------------------------------------- */
label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-heading);
}
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea {
  width: 100%;
  padding: 11px 13px;
  margin-top: 0;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}
input::placeholder, textarea::placeholder { color: #9aa1ac; }
select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--ring);
}
textarea { height: 88px; resize: vertical; line-height: 1.5; }
.checkbox-group { margin-top: 18px; }
.checkbox-group label {
  display: flex; align-items: center; gap: 9px;
  margin: 0; font-weight: 500; color: var(--color-text); cursor: pointer;
}
input[type="checkbox"] {
  width: 17px; height: 17px; margin: 0;
  accent-color: var(--color-primary);
  flex-shrink: 0; cursor: pointer;
}

/* Centered search box used on list/calendar views */
.search-container { margin: 4px 0 20px; position: relative; }
.search-container input {
  width: 100%; max-width: 420px;
  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 13px center;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn,
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--color-primary);
  color: #fff;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 1px 2px rgba(10, 36, 70, 0.18);
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover,
button[type="submit"]:hover { background-color: var(--color-primary-dark); box-shadow: 0 3px 10px rgba(10, 36, 70, 0.22); }
.btn:active, button[type="submit"]:active { transform: translateY(1px); }
button[type="submit"] { width: 100%; padding: 13px 22px; font-size: 15px; margin-top: 26px; }

/* Small button variants (table actions, header links) */
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: var(--radius-sm); box-shadow: none; }
.btn-primary { background-color: var(--color-primary); }
.btn-primary:hover { background-color: var(--color-primary-dark); }
.btn-success { background-color: var(--color-success); }
.btn-success:hover { background-color: var(--color-success-dark); }
.btn-danger  { background-color: var(--color-danger); }
.btn-danger:hover { background-color: var(--color-danger-dark); }
.btn-info    { background-color: var(--color-info); }
.btn-info:hover { background-color: var(--color-info-dark); }
.btn-neutral { background-color: var(--color-muted); }
.btn-neutral:hover { background-color: var(--color-muted-dark); }
.btn-sm.btn-success, .btn-sm.btn-danger, .btn-sm.btn-info, .btn-sm.btn-neutral { box-shadow: none; }

/* ---- Tables ------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  margin-top: 4px;
}
table { width: 100%; border-collapse: collapse; }
.table-wrapper table { margin-top: 0; }
th {
  background-color: var(--color-surface-2);
  color: var(--color-muted-dark);
  padding: 12px 15px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border-light);
}
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 14px;
  color: var(--color-text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background-color: var(--color-stripe); }
tbody tr:hover td { background-color: var(--color-primary-bg); }
.action-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Status badges ------------------------------------------------------ */
.status-pending,
.status-approved,
.status-denied {
  font-weight: 600;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.status-pending::before,
.status-approved::before,
.status-denied::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.status-pending  { color: var(--color-pending); background-color: var(--color-pending-bg);  border-color: rgba(245, 158, 11, 0.30); }
.status-approved { color: var(--color-success); background-color: var(--color-success-tint); border-color: rgba(22, 101, 52, 0.20); }
.status-denied   { color: var(--color-danger);  background-color: var(--color-danger-tint);  border-color: rgba(225, 29, 38, 0.22); }

/* ---- Pending availability changes queue (dashboard) --------------------- */
.avail-queue { margin-bottom: 20px; }
.avail-queue-title { font-size: 17px; color: var(--color-heading); margin-bottom: 2px; }
.avail-queue-hint { font-size: 12.5px; color: var(--color-muted); margin-bottom: 12px; }
.avail-change-card {
  border: 1.5px solid var(--color-pending-border);
  border-radius: var(--radius);
  background-color: var(--color-pending-bg);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.avail-change-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.avail-change-name { font-weight: 700; font-size: 15px; color: var(--color-heading); }
.avail-change-sub { font-size: 12px; color: var(--color-muted); margin-left: 8px; }
.avail-diff { background: var(--color-surface); border-radius: var(--radius-sm); overflow: hidden; }
.avail-diff th, .avail-diff td { padding: 6px 12px; font-size: 12.5px; }
.avail-diff tr.is-changed td { background-color: var(--color-pending-bg); color: var(--color-pending); }
.avail-diff tr.is-changed td:first-child { font-weight: 700; }

/* Capacity flag under the status badge: the tech submitted despite the date(s)
   already being at the max-off cap. Historical marker, not live state. */
.capacity-flag {
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-pending);
  white-space: nowrap;
}

/* ---- Coverage preview (dashboard, under each pending request) ----------- */
/* Fixed background so the row opts out of zebra striping and row hover. */
.coverage-row td,
.coverage-row:hover td,
tbody tr.coverage-row:nth-child(even) td {
  background-color: var(--color-surface-2);
  padding: 10px 15px 12px;
  border-top: none;
}
.coverage-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted-dark);
  margin-bottom: 6px;
}
.coverage-day {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 4px 0;
}
.coverage-day + .coverage-day { border-top: 1px solid var(--color-border-light); }
.coverage-date {
  flex: 0 0 76px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--color-heading);
  white-space: nowrap;
}
.coverage-lines {
  font-size: 12.5px;
  color: var(--color-text);
  line-height: 1.55;
}
.coverage-lines strong { color: var(--color-muted-dark); font-weight: 600; }
.coverage-sep { color: var(--color-muted); margin: 0 4px; }
.coverage-more {
  margin-top: 6px;
  font-size: 12px;
  font-style: italic;
  color: var(--color-muted);
}

/* ---- Messages / alerts -------------------------------------------------- */
.msg-error,
.msg-success,
.msg-warning {
  padding: 12px 15px;
  border-radius: var(--radius);
  margin-top: 14px;
  font-size: 14px;
  border: 1px solid transparent;
}
.msg-error   { background-color: var(--color-danger-tint);  border-color: rgba(225, 29, 38, 0.30);  color: var(--color-danger-dark); }
.msg-success { background-color: var(--color-success-tint); border-color: rgba(22, 101, 52, 0.28); color: var(--color-success-dark); }
.msg-warning { background-color: var(--color-pending-bg);   border-color: var(--color-pending-border); color: var(--color-pending); }

.empty-state { text-align: center; padding: 48px 40px; color: var(--color-muted); }
.empty-state p { font-size: 14.5px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  /* Safety net: no page should scroll sideways. Wide tables/grids still
     scroll inside their own .table-wrapper; this only clips stray overflow
     so the card never gets shoved off-screen. */
  .app-main { overflow-x: hidden; }
  /* Sidebar becomes a top bar: logo left, hamburger right; the nav collapses
     into a dropdown revealed by .nav-open. */
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    padding: 12px 16px;
    box-shadow: 0 2px 12px rgba(10, 36, 70, 0.18);
  }
  .sidebar-brand { margin-bottom: 0; gap: 11px; padding-right: 54px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 12px; }
  .brand-name { font-size: 16px; }
  .nav-toggle { display: inline-flex; position: absolute; top: 15px; right: 16px; }

  .sidebar-nav { display: none; margin-top: 12px; }
  .sidebar-footer { display: none; margin-top: 8px; padding-top: 10px;
                    border-top: 1px solid rgba(255, 255, 255, 0.18); }
  .sidebar.nav-open .sidebar-nav { display: flex; }
  .sidebar.nav-open .sidebar-footer { display: block; }
  .sidebar-footer a { max-width: none; margin: 0; }

  .container { padding: 20px 18px; }
  .page { padding: 20px 14px 44px; }
  h1 { font-size: 20px; }
  .page-head-icon { width: 40px; height: 40px; }
  /* iOS renders native date/time/text controls slightly wider than their CSS
     box, so they spill past the card. Force the CSS box model on mobile
     (desktop keeps its native calendar-picker icon). The native pickers still
     open on tap. Checkboxes/radios are untouched. */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="date"], input[type="time"], input[type="number"], textarea {
    -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%;
  }
}
