/* ============================================================
   GWS Admin — Warm Industrial Design System
   (Adapted from WhatsUp Admin)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-root: #0c0c0f;
  --bg-surface-0: #131318;
  --bg-surface-1: #1a1a22;
  --bg-surface-2: #22222d;
  --bg-surface-3: #2a2a38;

  --text-primary: #ececf0;
  --text-secondary: #9494a8;
  --text-tertiary: #5e5e72;
  --text-inverse: #0c0c0f;

  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-subtle: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.25);

  --success: #22c55e;
  --success-subtle: rgba(34, 197, 94, 0.15);
  --danger: #ef4444;
  --danger-subtle: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-subtle: rgba(59, 130, 246, 0.15);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-focus: var(--accent);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 100px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  --header-h: 56px;
  --sidebar-w: 240px;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent); color: var(--text-inverse); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface-3); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Header */
.header {
  background: rgba(19, 19, 24, 0.8);
  backdrop-filter: blur(16px) saturate(180%);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
}
.header .brand {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header .brand::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--accent-glow);
}
.header .spacer { flex: 1; }
.header .user-info { font-size: 0.82rem; color: var(--text-tertiary); }
.header .logout-btn {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
}
.header .logout-btn:hover {
  background: var(--danger-subtle);
  border-color: var(--danger);
  color: var(--danger);
}

/* Language selector */
.lang-selector { position: relative; }
.header .lang-btn, .login-header .lang-btn {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.header .lang-btn:hover, .login-header .lang-btn:hover { border-color: var(--accent); }
.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  min-width: 110px;
  z-index: 200;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.lang-dropdown.open { display: block; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-weight: 500;
  text-align: left;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.lang-option:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.lang-option.active { background: var(--accent-subtle); color: var(--accent); }

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: rgba(19, 19, 24, 0.6);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
}
.sidebar .nav-section { padding: 0.25rem 0; }
.sidebar .nav-section-title {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  padding: 0.8rem 1.25rem 0.4rem;
  font-weight: 600;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 450;
  text-decoration: none;
  margin: 1px 0;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}
.sidebar a:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.04); }
.sidebar a.active { color: var(--accent); background: var(--accent-subtle); }
.sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.sidebar .nav-icon {
  width: 20px; height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.6;
}
.sidebar .nav-icon svg { width: 16px; height: 16px; }
.sidebar a.active .nav-icon { opacity: 1; }

/* App Layout */
.app-layout {
  padding-top: var(--header-h);
  padding-left: var(--sidebar-w);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  animation: fadeInUp var(--duration-slow) var(--ease-out);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography */
h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}
h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Cards */
.card {
  background: var(--bg-surface-1);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-normal) var(--ease-out);
}
.card:hover { border-color: var(--border-hover); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
}
.btn-secondary:hover {
  background: var(--bg-surface-3);
  color: var(--text-primary);
}
.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}
.btn-danger {
  background: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--danger);
}

/* Forms */
.form-group { margin-bottom: 1.15rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-surface-0);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  transition: all var(--duration-fast) var(--ease-out);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-active { background: var(--success-subtle); color: var(--success); }
.badge-inactive { background: rgba(255, 255, 255, 0.06); color: var(--text-tertiary); }
.badge-role { background: var(--info-subtle); color: var(--info); }
.badge-success { background: var(--success-subtle); color: var(--success); }
.badge-rejected { background: var(--danger-subtle); color: var(--danger); }
.badge-error { background: rgba(255, 165, 0, 0.15); color: orange; }
.badge-env { font-size: 0.6rem; padding: 0.15em 0.5em; margin-left: 0.5rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; vertical-align: middle; }
.badge-env-local { background: var(--success-subtle); color: var(--success); }
.badge-env-staging { background: rgba(255, 165, 0, 0.15); color: orange; }
.badge-env-production { display: none; }

/* API Reference card */
.api-ref { margin-top: 1.5rem; }
.api-ref h2 { margin-bottom: 0.75rem; }
.api-ref-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; min-width: 0; }
.api-ref-card h3 { font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.api-ref-card .method { font-weight: 700; font-size: 0.7rem; padding: 0.15em 0.4em; border-radius: 3px; margin-right: 0.5rem; }
.api-ref-card .method-post { background: rgba(73, 204, 144, 0.15); color: #49cc90; }
.api-ref-card .method-ws { background: rgba(97, 175, 254, 0.15); color: #61affe; }
.api-ref-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.api-ref-card .url { font-family: 'DM Mono', monospace; font-size: 0.8rem; color: var(--text-secondary); word-break: break-all; }
.api-ref-card pre { background: var(--surface-1); border-radius: 6px; padding: 0.75rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-secondary); overflow-x: auto; white-space: pre; font-family: 'DM Mono', monospace; }
.api-ref-card .note { font-size: 0.7rem; color: var(--text-tertiary); margin-top: 0.4rem; }

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; animation: modalOverlayIn var(--duration-normal) var(--ease-out); }
@keyframes modalOverlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface-1);
  border-radius: var(--radius-xl);
  padding: 2rem;
  min-width: 420px;
  max-width: 560px;
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn var(--duration-normal) var(--ease-spring);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h2 { font-family: var(--font-heading); margin-bottom: 1.25rem; font-size: 1.2rem; }
.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.toolbar h1 { margin-bottom: 0; }

/* Alerts */
.alert {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.88rem;
  font-weight: 450;
  animation: alertSlideIn var(--duration-normal) var(--ease-out);
}
.alert-success { background: var(--success-subtle); border: 1px solid rgba(34, 197, 94, 0.25); color: var(--success); }
.alert-error { background: var(--danger-subtle); border: 1px solid rgba(239, 68, 68, 0.25); color: var(--danger); }
@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}
.login-container::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(245, 158, 11, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 80% 40% at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.login-box {
  background: var(--bg-surface-1);
  padding: 2.5rem 2.5rem 2rem;
  border-radius: var(--radius-xl);
  width: 380px;
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: loginBoxIn 0.6s var(--ease-spring);
}
@keyframes loginBoxIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.login-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.login-header h1 { margin: 0; }
.login-box h1 {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.login-box h1::before {
  content: '';
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--accent-glow);
}
.login-box .btn {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.7rem;
  font-size: 0.9rem;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--bg-surface-1);
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--duration-normal);
}
.stat:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat:hover::before { opacity: 1; }
.stat .number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.stat .label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* AG Grid */
.grid-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.grid-search {
  flex: 1;
  max-width: 320px;
  padding: 0.5rem 0.85rem;
  background: var(--bg-surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
}
.grid-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.grid-search::placeholder { color: var(--text-tertiary); }
.grid-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* WS Monitor */
.ws-monitor {
  background: var(--bg-surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  height: 400px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}
.ws-monitor .msg {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}
.ws-monitor .msg:last-child { border-bottom: none; }
.ws-monitor .msg-time { color: var(--text-tertiary); white-space: nowrap; }
.ws-monitor .msg-content { color: var(--text-secondary); word-break: break-all; }
.ws-monitor .msg-ping { color: var(--text-tertiary); opacity: 0.5; }

.ws-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.ws-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.ws-status.connected .dot { background: var(--success); box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }

/* Settings form */
.settings-form {
  max-width: 600px;
}
.settings-form .api-key-field {
  display: flex;
  gap: 0.5rem;
}
.settings-form .api-key-field input { flex: 1; }

/* Changelog / Historic */
.hist-search-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.hist-search-wrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-surface-2); border: 1px solid var(--border-hover);
  border-radius: var(--radius-md); padding: 6px 12px; min-width: 220px;
}
.hist-search-wrap svg { color: var(--text-secondary); flex-shrink: 0; }
.hist-search-wrap input {
  border: none; background: none; outline: none;
  color: var(--text-primary); font-size: 0.78rem; width: 100%;
}
.hist-search-wrap input::placeholder { color: var(--text-secondary); }
.hist-search-options { display: flex; align-items: center; gap: 4px; }
.hist-opt-btn {
  background: var(--bg-surface-2); border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm); padding: 2px 7px; font-size: 0.7rem; font-weight: 700;
  color: var(--text-secondary); cursor: pointer; font-family: 'SF Mono', monospace;
  transition: all var(--duration-fast); line-height: 1.4;
}
.hist-opt-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.hist-opt-btn.active { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.hist-nav-btn {
  background: none; border: 1px solid var(--border-hover); border-radius: var(--radius-sm);
  padding: 1px 6px; font-size: 0.6rem; color: var(--text-secondary); cursor: pointer;
  transition: all var(--duration-fast); line-height: 1;
}
.hist-nav-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.hist-match-count {
  font-size: 0.68rem; color: var(--text-secondary); font-family: 'SF Mono', monospace;
  min-width: 40px; text-align: center;
}
mark.hist-highlight {
  background: rgba(250, 204, 21, 0.3); color: inherit; border-radius: 2px;
  padding: 0 1px; scroll-margin-top: 80px;
}
mark.hist-highlight.current {
  background: rgba(250, 204, 21, 0.65); outline: 2px solid rgba(250, 204, 21, 0.55);
}
.hist-content {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 0; min-height: 120px; max-height: calc(100vh - 260px); overflow-y: auto;
}
.hist-group { border: none; }
.hist-group summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  list-style: none; padding: 8px 12px; border-radius: var(--radius-md);
  font-family: 'SF Mono', monospace; transition: background var(--duration-fast);
}
.hist-group summary::-webkit-details-marker { display: none; }
.hist-group summary:hover { background: var(--accent-subtle); }
.hist-chevron {
  font-size: 0.55rem; color: var(--text-secondary); transition: transform 0.2s;
  display: inline-block; width: 12px; text-align: center;
}
.hist-group[open] > summary .hist-chevron { transform: rotate(90deg); }
.hist-group-label { font-weight: 700; }
.hist-group-count { font-size: 0.65rem; color: var(--text-secondary); }
.hist-group-badge { font-size: 0.65rem; color: var(--accent); opacity: 0.8; }
.hist-group-body { padding-left: 16px; }
.hist-year-summary { font-size: 1rem; color: var(--text-primary); }
.hist-year-summary .hist-group-label { color: var(--accent); }
.hist-month-summary { font-size: 0.85rem; color: var(--text-primary); }
.hist-day-summary { font-size: 0.78rem; color: var(--text-secondary); }
.hist-day-summary .hist-group-label { min-width: 20px; text-align: right; }
.hist-version-summary { font-size: 0.76rem; color: var(--text-secondary); padding: 4px 12px; }
.hist-ver-label { font-weight: 700; color: var(--accent); font-family: 'SF Mono', monospace; font-size: 0.74rem; }
.hist-day-body { padding: 6px 0 6px 20px; }
.hist-cat { margin-bottom: 8px; }
.hist-cat:last-child { margin-bottom: 0; }
.hist-cat h4 {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px;
  margin: 0 0 6px; font-weight: 600;
}
.hist-cat ul { list-style: none; margin: 0; padding: 0; }
.hist-cat li {
  font-size: 0.76rem; color: var(--text-secondary); padding: 3px 0;
  display: flex; align-items: baseline; gap: 6px; line-height: 1.5;
}
.hist-icon { font-weight: 700; font-size: 0.7rem; flex-shrink: 0; width: 12px; text-align: center; }
.hist-note { font-size: 0.72rem; color: var(--text-secondary); font-style: italic; margin: 0; }
.hist-empty { text-align: center; padding: 60px 20px; color: var(--text-secondary); font-size: 0.82rem; }
.hist-toggle-btn {
  background: var(--bg-surface-2); border: 1px solid var(--border-hover);
  border-radius: var(--radius-md); padding: 4px 12px; font-size: 0.7rem;
  color: var(--accent); cursor: pointer; font-family: 'SF Mono', monospace;
  transition: all var(--duration-fast);
}
.hist-toggle-btn:hover { background: var(--accent-subtle); border-color: var(--accent); }
.hist-section-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 0.55rem; padding: 2px 6px;
  border-radius: var(--radius-sm); margin-left: auto; transition: all var(--duration-fast);
  line-height: 1; opacity: 0.6;
}
.hist-section-toggle:hover { opacity: 1; background: var(--accent-subtle); color: var(--accent); }

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .app-layout { padding-left: 0; }
  .container { padding: 1.25rem; }
  .modal { min-width: auto; margin: 1rem; width: calc(100% - 2rem); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .api-ref-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
