/* RegBite — Ink Palette */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────────────── */
:root {
  --font: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  /* Layout */
  --sidebar-w: 220px;
  --topbar-h:  60px;

  /* Ink — primary brand color scale */
  --ink-50:  #F1F4F8;
  --ink-100: #DDE4ED;
  --ink-200: #B6C3D5;
  --ink-300: #8095B3;
  --ink-400: #4B6690;
  --ink-500: #2B4874;
  --ink-600: #173558;
  --ink-700: #0B2A4A;
  --ink-900: #051324;

  /* Background */
  --bg:         #F1F4F8;
  --sidebar-bg: #0B2A4A;
  --card-bg:    #FFFFFF;
  --border:     #DDE4ED;
  --white:      #FFFFFF;
  --black:      #051324;

  /* Grayscale palette — neutral text/borders */
  --gray-50:  #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EBEBEB;
  --gray-300: #D4D4D4;
  --gray-400: #A3A3A3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --ink:      #111111;

  /* Brand palette — Ink replaces teal as primary interactive */
  --teal:      #2B4874;   /* ink-500 */
  --sage:      #357266;   /* Pine — success/pass */
  --steel:     #525252;   /* neutral secondary */
  --peach:     #E5E5E5;
  --teal-light:  #F1F4F8;
  --sage-light:  #EAF2F0;
  --steel-light: #F0F0F0;
  --peach-light: #F5F5F5;
  --teal-dark:   #0B2A4A;
  --sage-dark:   #2A5C50;
  --steel-dark:  #404040;
  --peach-dark:  #737373;

  /* Status colors — unchanged */
  --success-bg: #EAF2F0; --success-fg: #357266;
  --warning-bg: #FEF9EC; --warning-fg: #8F6314;
  --danger-bg:  #FDEBEC; --danger-fg:  #DF2935;
  --info-bg:    #DDE4ED; --info-fg:    #2B4874;

  /* Semantic */
  --primary:       #2B4874;
  --primary-dark:  #0B2A4A;
  --primary-light: #F1F4F8;
  --accent:        #525252;
  --accent-dark:   #404040;
  --success:       #357266;
  --warning:       #8F6314;
  --danger:        #DF2935;
  --info:          #2B4874;

  --green-400: #EAF2F0;
  --green-500: #7FB8AD;
  --green-600: #357266;
  --green-700: #2A5C50;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow:    0 2px 8px rgba(0,0,0,0.07);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);

  --r-xs: 4px; --r-sm: 6px; --r-md: 6px; --r-lg: 6px; --r-xl: 8px; --r-full: 9999px;
  --t: 0.12s ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 0.875rem; line-height: 1.7; color: var(--ink);
  background: var(--bg); min-height: 100vh;
  letter-spacing: 0.01em;
}

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

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0B2A4A;
  border-right: 1px solid #173558;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1.2rem 1.1rem 1rem;
  display: flex; align-items: center; gap: 0.6rem;
  border-bottom: 1px solid #173558;
  flex-shrink: 0;
}
.sidebar-logo {
  filter: brightness(0) invert(1);
}

.sidebar-nav {
  padding: 0.75rem 0;
  flex: 1;
  display: flex; flex-direction: column; gap: 0;
}

.sidebar-section-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: #8095B3;
  padding: 0.8rem 1.2rem 0.3rem;
}

.sidebar-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1.2rem;
  border-left: 2px solid transparent;
  font-size: 0.82rem; font-weight: 400; color: #B6C3D5;
  text-decoration: none; transition: all var(--t); position: relative;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: #ffffff; text-decoration: none; border-left-color: #8095B3; }
.sidebar-link.active { background: rgba(255,255,255,0.12); color: #ffffff; font-weight: 500; border-left-color: #DDE4ED; }
.sidebar-link.active:hover { background: rgba(255,255,255,0.12); color: #ffffff; }
.sidebar-link.admin-link { color: #B6C3D5; }
.sidebar-link.admin-link:hover { background: rgba(255,255,255,0.07); color: #ffffff; }
.sidebar-link.admin-link.active { background: rgba(255,255,255,0.12); color: #ffffff; border-left-color: #DDE4ED; }

.sidebar-icon { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #8095B3; }
.sidebar-icon svg { width: 16px; height: 16px; }
.sidebar-link:hover .sidebar-icon { color: #DDE4ED; }
.sidebar-link.active .sidebar-icon { color: #DDE4ED; }
.sidebar-badge {
  margin-left: auto; background: #DF2935; color: #fff;
  border-radius: var(--r-full); min-width: 17px; height: 17px; padding: 0 4px;
  font-size: 0.6rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}

/* Sidebar upgrade / info card */
.sidebar-upgrade {
  margin: 0.5rem 0.75rem 1rem;
  padding: 0.9rem 1rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-md);
}
.sidebar-upgrade h5 { font-size: 0.78rem; font-weight: 500; color: #DDE4ED; margin-bottom: 0.15rem; }
.sidebar-upgrade p  { font-size: 0.72rem; color: #8095B3; margin-bottom: 0.6rem; line-height: 1.5; }

/* ─── Main Area ──────────────────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  background: #FFFFFF; border-bottom: 1px solid #EBEBEB;
  padding: 0 1.75rem; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 0.85rem; }
.topbar-greeting { }
.topbar-greeting h2 { font-size: 1rem; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; line-height: 1.3; }
.topbar-greeting p  { font-size: 0.75rem; color: #A3A3A3; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-date  { font-size: 0.78rem; color: #737373; font-weight: 400; display: flex; align-items: center; gap: 0.35rem; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #4B6690, #0B2A4A);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 500; color: #fff; cursor: pointer;
  flex-shrink: 0;
}

/* Hamburger toggle (mobile) */
.sidebar-toggle {
  display: none; background: none;
  border: 1px solid #EBEBEB; border-radius: var(--r-sm);
  cursor: pointer; padding: 0.35rem 0.5rem;
  color: #737373; font-size: 1rem; line-height: 1;
  transition: all var(--t);
}
.sidebar-toggle:hover { background: #F5F5F5; color: var(--teal-dark); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ─── Page Content ───────────────────────────────────────────────────── */
.page-content { padding: 1.75rem 2rem; flex: 1; }
.page-wrap        { width: 100%; }
.page-wrap-narrow { max-width: 720px; margin: 0 auto; }

/* ─── Typography ─────────────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 500; }
h2 { font-size: 1.25rem; font-weight: 500; }
h3 { font-size: 1rem; font-weight: 500; }
h4 { font-size: 0.9rem; font-weight: 500; }
h1,h2,h3,h4,h5 { line-height: 1.3; color: var(--ink); letter-spacing: -0.01em; }
p  { color: #525252; }
a  { color: var(--teal-dark); text-decoration: none; transition: color var(--t); }
a:hover { text-decoration: underline; color: var(--steel-dark); }
small  { font-size: 0.79rem; color: #737373; }
strong { font-weight: 500; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.2rem; }
code {
  font-family: 'Fira Mono','Consolas',monospace; font-size: 0.8em;
  background: #F5F5F5; border: 1px solid #EBEBEB;
  padding: 0.14em 0.44em; border-radius: 4px; color: #525252;
}
pre {
  background: #FAFAFA; border: 1px solid #EBEBEB;
  border-radius: var(--r-md); padding: 1rem 1.2rem; overflow: auto;
  font-size: 0.78rem; white-space: pre-wrap;
  font-family: 'Fira Mono','Consolas',monospace; line-height: 1.55;
}

/* ─── Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg); border: 1px solid #EBEBEB;
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 1.4rem;
  transition: box-shadow var(--t);
}
.card:hover { box-shadow: var(--shadow); }
.card-sm    { padding: 1rem; border-radius: var(--r-sm); }
.card-flat  { box-shadow: none; }
.card-flat:hover { box-shadow: var(--shadow-sm); }
.no-hover:hover { box-shadow: var(--shadow-sm); transform: none; }

/* ─── Stat Cards ─────────────────────────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card-bg); border: 1px solid #EBEBEB;
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.2rem;
  display: flex; align-items: center; gap: 0.9rem;
  transition: box-shadow var(--t);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; flex-shrink: 0;
  background: var(--teal-light); color: var(--teal-dark);
}
.stat-card-body {}
.stat-card-val { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--teal-dark); }
.stat-card-lbl { font-size: 0.72rem; color: #737373; margin-top: 0.2rem; font-weight: 400; letter-spacing: 0.02em; }
.stat-card-delta { font-size: 0.7rem; font-weight: 500; margin-top: 0.12rem; }
.delta-up   { color: #357266; }
.delta-down { color: #DF2935; }
.delta-neutral { color: #A3A3A3; }

/* ─── BUTTONS ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.38rem;
  padding: 0.5rem 1.1rem; border-radius: var(--r-sm);
  font-family: var(--font); font-size: 0.82rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1;
  transition: all var(--t);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { opacity: 0.85; }

/* PRIMARY — teal filled */
.btn-primary {
  background: var(--teal); color: #FFFFFF; border-color: var(--teal);
}
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #FFFFFF; }

/* SUCCESS — sage filled */
.btn-success {
  background: var(--sage-dark); color: #FFFFFF; border-color: var(--sage-dark);
}
.btn-success:hover { background: #262626; border-color: #262626; color: #FFFFFF; }

/* ACCENT — outline style */
.btn-accent {
  background: transparent; color: var(--teal-dark); border-color: var(--teal);
}
.btn-accent:hover { background: var(--teal-light); }

/* SECONDARY — outline */
.btn-secondary {
  background: transparent; color: var(--ink); border-color: #D4D4D4;
}
.btn-secondary:hover { background: var(--teal-light); border-color: var(--teal); }

/* OUTLINE */
.btn-outline {
  background: #FFFFFF; color: var(--ink); border: 1px solid #D4D4D4;
}
.btn-outline:hover { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal); }

/* GHOST */
.btn-ghost {
  background: transparent; color: var(--ink); border: 1px solid #D4D4D4;
}
.btn-ghost:hover { background: var(--teal-light); color: var(--teal-dark); }

/* DANGER */
.btn-danger { background: transparent; color: #DF2935; border: 1px solid #DF2935; }
.btn-danger:hover { background: #FDEBEC; }

/* DANGER SOFT */
.btn-danger-soft {
  background: #FDEBEC; color: #DF2935; border: 1px solid #F5C0C3;
}
.btn-danger-soft:hover { background: #FBD7D9; }

.btn-sm  { padding: 0.28rem 0.75rem; font-size: 0.76rem; }
.btn-lg  { padding: 0.65rem 1.5rem; font-size: 0.9rem; }
.btn-xl  { padding: 0.75rem 1.75rem; font-size: 0.9rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
.field-label { display: block; font-size: 0.78rem; font-weight: 500; color: #404040; margin-bottom: 0.27rem; letter-spacing: 0.03em; }
.field-hint  { display: block; font-size: 0.74rem; color: #A3A3A3; margin-top: 0.2rem; }

.input, select.input, textarea.input {
  width: 100%; padding: 0.55rem 0.85rem;
  border: 1px solid #D4D4D4; border-radius: var(--r-sm);
  font-family: var(--font); font-size: 0.85rem; color: #111111;
  background: #fff; transition: border-color var(--t);
  outline: none; appearance: none; box-shadow: none;
}
.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(43,72,116,0.15);
}
.input::placeholder { color: #D4D4D4; }
textarea.input { resize: vertical; min-height: 80px; }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23A3A3A3' stroke-width='1.5' stroke-linecap='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.5rem;
}
.error-banner {
  background: #FDEBEC; border: 1px solid #F5C0C3;
  border-radius: var(--r-sm); padding: 0.65rem 1rem;
  font-size: 0.84rem; color: #DF2935; margin-bottom: 1rem;
}

/* ─── Pills / Badges ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 0.22rem;
  padding: 0.15rem 0.55rem; border-radius: var(--r-full);
  font-size: 0.7rem; font-weight: 500; white-space: nowrap;
}
.pill-good    { background: #EAF2F0; color: #357266; }
.pill-warn    { background: #FEF9EC; color: #8F6314; }
.pill-bad     { background: #FDEBEC; color: #DF2935; }
.pill-neutral { background: #F5F5F5; color: #525252; border: 1px solid #EBEBEB; }
.pill-primary { background: var(--teal-light); color: var(--teal); border: 1px solid rgba(43,72,116,0.25); }
.pill-accent  { background: var(--steel-light); color: var(--steel-dark); border: 1px solid var(--steel); }
.pill-green   { background: #EAF2F0; color: #357266; }
.pill-new     { background: #EBF0FF; color: #3772FF; }

.badge-alert {
  display: inline-flex; align-items: center; justify-content: center;
  background: #DF2935; color: #fff; border-radius: var(--r-full);
  min-width: 16px; height: 16px; padding: 0 4px;
  font-size: 0.6rem; font-weight: 700; vertical-align: middle; margin-left: 3px;
}

/* Severity */
.sev-tag {
  display: inline-flex; align-items: center;
  padding: 0.14rem 0.5rem; border-radius: var(--r-full);
  font-size: 0.64rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.sev-CRITICAL { background: #FDEBEC; color: #DF2935; }
.sev-HIGH     { background: #FEF9EC; color: #8F6314; }
.sev-MEDIUM   { background: #DDE4ED; color: #2B4874; }
.sev-LOW      { background: #F5F5F5; color: #737373; }

/* Score circle */
.score-circle {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem; font-weight: 700;
}
.sc-good { background: #EAF2F0; color: #357266; }
.sc-warn { background: #FEF9EC; color: #8F6314; }
.sc-bad  { background: #FDEBEC; color: #DF2935; }
.sc-none { background: #F5F5F5; color: #A3A3A3; }

/* ─── Page Header ────────────────────────────────────────────────────── */
.page-hdr { margin-bottom: 1.4rem; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.page-hdr h2 { font-weight: 500; font-size: 1.25rem; letter-spacing: -0.01em; }
.page-hdr p  { color: #737373; margin-top: 0.1rem; font-size: 0.82rem; }

/* ─── Tabs ───────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid #EBEBEB; margin-bottom: 1.4rem; }
.tab {
  padding: 0.5rem 1rem; font-size: 0.82rem; font-weight: 400; color: #737373;
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all var(--t); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.tab:hover { color: var(--teal-dark); text-decoration: none; }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal-dark); font-weight: 500; }
.tab-badge {
  background: #EBEBEB; color: #525252; border-radius: var(--r-full);
  padding: 0 0.4rem; font-size: 0.64rem; min-width: 17px; text-align: center; line-height: 1.7;
}
.tab.active .tab-badge { background: #F5F5F5; color: #262626; }

/* ─── Table ──────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; border-radius: var(--r-md);
  border: 1px solid #EBEBEB; background: var(--card-bg);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
table.tbl th {
  text-align: left; padding: 0.65rem 1rem;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: #A3A3A3; background: #FAFAFA; border-bottom: 1px solid #EBEBEB;
}
table.tbl td { padding: 0.72rem 1rem; border-bottom: 1px solid #F5F5F5; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #FAFAFA; }

/* ─── Grid ───────────────────────────────────────────────────────────── */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1rem; }
.two-col    { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.three-col  { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.9rem; }

/* ─── Dashboard layout (main + right panel) ──────────────────────────── */
.dash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}
.dash-main {}
.dash-side { display: flex; flex-direction: column; gap: 1rem; }

/* User profile card (right panel) */
.profile-card { text-align: center; padding: 1.4rem 1rem; }
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 0.6rem;
  background: linear-gradient(135deg, #4B6690, #0B2A4A);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 500; color: #fff;
}
.profile-name { font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.profile-handle { font-size: 0.76rem; color: #A3A3A3; margin-top: 0.1rem; }
.profile-actions { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.9rem; }
.profile-action-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: #F5F5F5; border: 1px solid #EBEBEB;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; cursor: pointer; transition: all var(--t);
  text-decoration: none; color: #737373;
}
.profile-action-btn:hover { background: var(--teal-light); text-decoration: none; color: var(--teal-dark); }

/* Activity / quick links in right panel */
.activity-header {
  font-size: 0.8rem; font-weight: 500; color: #262626;
  padding: 0 0 0.6rem; border-bottom: 1px solid #EBEBEB; margin-bottom: 0.7rem;
}
.activity-item {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.5rem 0; border-bottom: 1px solid #F5F5F5; font-size: 0.8rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: #EBEBEB; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 500; color: #525252;
}
.activity-text { flex: 1; min-width: 0; }
.activity-name { font-weight: 500; color: #262626; }
.activity-desc { color: #737373; font-size: 0.76rem; }
.activity-time { font-size: 0.7rem; color: #A3A3A3; flex-shrink: 0; }

/* ─── Alert items ────────────────────────────────────────────────────── */
.alert-item {
  background: var(--card-bg); border: 1px solid #EBEBEB; border-left-width: 3px;
  border-radius: var(--r-md); padding: 1rem 1.2rem; margin-bottom: 0.75rem;
}
.alert-item.sev-CRITICAL { border-left-color: #DF2935; background: rgba(223,41,53,0.05); }
.alert-item.sev-HIGH     { border-left-color: #8F6314; background: rgba(143,99,20,0.05); }
.alert-item.sev-MEDIUM   { border-left-color: #2B4874; background: rgba(43,72,116,0.04); }
.alert-item.sev-LOW      { border-left-color: #D4D4D4; }

/* ─── Upload zone ────────────────────────────────────────────────────── */
.upload-zone {
  border: 1.5px dashed #D4D4D4; border-radius: var(--r-xl);
  padding: 2.5rem 2rem; text-align: center; cursor: pointer;
  background: #FAFAFA; transition: all var(--t);
}
.upload-zone:hover { border-color: var(--teal); background: var(--teal-light); }

/* ─── Breadcrumb ─────────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: #A3A3A3; margin-bottom: 1.1rem; }
.breadcrumb a { color: #737373; }
.breadcrumb a:hover { color: var(--teal-dark); text-decoration: none; }

/* ─── Flash ──────────────────────────────────────────────────────────── */
.flash { padding: 0.7rem 1rem; border-radius: var(--r-sm); font-size: 0.82rem; margin-bottom: 1rem; }
.flash-success { background: #EAF2F0; color: #357266; border-left: 3px solid #357266; }
.flash-error   { background: #FDEBEC; color: #DF2935; border-left: 3px solid #DF2935; }
.flash-info    { background: var(--info-bg); color: var(--info-fg); border-left: 3px solid var(--info); }

/* ─── Info box ───────────────────────────────────────────────────────── */
.info-box { background: #F5F5F5; border: 1px solid #EBEBEB; border-radius: var(--r-sm); padding: 0.75rem 1rem; font-size: 0.82rem; color: #525252; }

/* ─── Empty state ────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-icon  { font-size: 2rem; display: block; margin-bottom: 0.65rem; color: #D4D4D4; }
.empty-state h3 { color: #737373; font-weight: 400; margin-bottom: 0.3rem; font-size: 0.95rem; }
.empty-state p  { color: #A3A3A3; font-size: 0.82rem; }

/* ─── Misc ───────────────────────────────────────────────────────────── */
hr.divider { border: none; border-top: 1px solid #EBEBEB; margin: 1.4rem 0; }
.grad-text { color: var(--teal-dark); }
details summary { cursor: pointer; color: #525252; font-size: 0.82rem; font-weight: 500; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '\25B6  '; font-size: 0.6em; }
details[open] summary::before { content: '\25BC  '; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ─── Auth ───────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem; background: var(--bg);
}
.auth-card { width: 100%; max-width: 400px; }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid #EBEBEB; border-top-color: var(--teal); border-radius: 50%; animation: spin 0.65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.site-footer { text-align: center; padding: 1.25rem 2rem; color: #A3A3A3; font-size: 0.72rem; border-top: 1px solid #EBEBEB; }

/* ─── Mobile Bottom Nav ──────────────────────────────────────────────── */
.mob-nav {
  display: none; /* shown via @media (max-width:900px) */
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #FFFFFF; border-top: 1px solid #EBEBEB;
  z-index: 110; padding: 0 0.25rem env(safe-area-inset-bottom, 0);
  flex-direction: row;
}
.mob-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.5rem 0.25rem 0.4rem;
  color: #A3A3A3; font-size: 0.65rem; text-decoration: none;
  border: none; background: none; cursor: pointer; font-family: var(--font);
  gap: 0.18rem; transition: color var(--t); position: relative;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px; touch-action: manipulation;
}
.mob-nav-item:hover, .mob-nav-item.active { color: var(--teal); text-decoration: none; }
.mob-nav-icon { font-size: 1.1rem; line-height: 1; display: block; }
.mob-nav-lbl  { font-size: 0.65rem; font-weight: 500; letter-spacing: 0.02em; display: block; position: relative; }
.mob-nav-badge {
  position: absolute; top: -6px; right: -8px;
  background: #DF2935; color: #fff; border-radius: 99px;
  font-size: 0.48rem; font-weight: 700; padding: 0.05rem 0.3rem;
  min-width: 12px; text-align: center; line-height: 1.5;
}

/* Toast */
.toast-alert {
  position: fixed; top: 70px; right: 1.5rem;
  background: #fff; border: 1px solid #D4D4D4; border-left: 3px solid #3772FF;
  border-radius: var(--r-sm); padding: 0.8rem 1rem;
  box-shadow: var(--shadow); z-index: 500;
  display: flex; align-items: center; gap: 0.7rem; max-width: 290px;
  animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:translateX(0); } }
.toast-close { background:none; border:none; color:#A3A3A3; cursor:pointer; font-size:1rem; padding:0; line-height:1; margin-left:0.2rem; }

/* ─── Responsive ─────────────────────────────────────────────────────── */

/* ── ≤1100px: collapse dashboard side panel ── */
@media (max-width: 1100px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-side { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* ── ≤900px: sidebar becomes drawer + bottom nav appears ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-area { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .mob-nav { display: flex; }
  /* push footer above bottom nav */
  .site-footer { padding-bottom: calc(1.25rem + 60px); }
}

/* ── ≤768px: tablet / large phone ── */
@media (max-width: 768px) {
  .page-content { padding: 1.25rem 1rem 4rem; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.05rem; }
  h3 { font-size: 0.95rem; }

  /* Page header: stack vertically, actions wrap */
  .page-hdr { flex-direction: column; gap: 0.75rem; }
  .page-hdr > div:last-child { display: flex; flex-wrap: wrap; gap: 0.4rem; width: 100%; }
  .page-hdr > div:last-child .btn { flex: 1; justify-content: center; min-height: 40px; }

  /* Utility */
  .hide-sm { display: none !important; }

  /* Grids: single column */
  .two-col, .three-col { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
  .dash-side { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }

  /* Topbar */
  .topbar { padding: 0 1rem; }
  .topbar-date { display: none; }
  .topbar-greeting h2 {
    font-size: 0.9rem; max-width: 160px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar-greeting p { display: none; }

  /* Tabs: horizontal scroll, larger touch target */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .tab  { white-space: nowrap; flex-shrink: 0; min-height: 40px; }

  /* Tables: force horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tbl th, table.tbl td { white-space: nowrap; }

  /* Inputs: ensure comfortable touch height */
  .input, select.input { min-height: 42px; }

  /* Cards: slightly tighter */
  .card { padding: 1.1rem; }

  /* Code/pre: never overflow */
  pre  { overflow-x: auto; white-space: pre; font-size: 0.72rem; }
  code { word-break: break-all; }

  /* Toast: full-width at top */
  .toast-alert {
    right: 0.75rem; left: 0.75rem; max-width: none;
    top: 68px;
  }

  /* Upload zone: less padding */
  .upload-zone { padding: 1.75rem 1rem; }

  /* Breadcrumb: wrap */
  .breadcrumb { flex-wrap: wrap; }

  /* Sidebar upgrade card */
  .sidebar-upgrade { display: none; }
}

/* ── ≤480px: small phones ── */
@media (max-width: 480px) {
  .page-content { padding: 1rem 0.85rem 4.5rem; }
  h1 { font-size: 1.2rem; }
  h2 { font-size: 1rem; }

  .topbar { padding: 0 0.75rem; height: 54px; }
  .topbar-greeting h2 { max-width: 140px; font-size: 0.85rem; }
  .topbar-avatar { width: 32px; height: 32px; font-size: 0.75rem; } /* keep at 32px — don't shrink further */

  .stat-strip { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .stat-card { padding: 0.85rem 0.9rem; gap: 0.6rem; }
  .stat-card-val { font-size: 1.2rem; }
  .stat-card-icon { width: 32px; height: 32px; font-size: 0.8rem; }

  .card { padding: 0.9rem; }

  .btn { font-size: 0.79rem; padding: 0.45rem 0.9rem; }
  .btn-sm { font-size: 0.72rem; padding: 0.3rem 0.7rem; }
  .btn-lg, .btn-xl { padding: 0.6rem 1.2rem; font-size: 0.85rem; }

  /* Score circle: smaller on tiny screens */
  .score-circle { width: 46px; height: 46px; font-size: 0.8rem; }

  /* Table cells: reduce padding */
  table.tbl th { padding: 0.5rem 0.65rem; }
  table.tbl td { padding: 0.6rem 0.65rem; }

  /* Sidebar: full-width overlay on very small screens */
  .sidebar { width: min(85vw, 260px); }

  /* Auth card */
  .auth-wrap { padding: 1.25rem 0.85rem; }

  /* Toast */
  .toast-alert { right: 0.5rem; left: 0.5rem; top: 62px; }
}

/* ─── Print Styles ───────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .mobile-trigger, nav, footer,
  .toast-alert, button, .btn, form { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; width: 100% !important; }
  body { background: white !important; color: black !important; font-size: 12pt; }
  a { color: black !important; text-decoration: underline; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
}
