/*
 * Plan 0116 Phase A — Hub as Cassette Player.
 * Sidebar (left) + main frame (right). The Cassette Player IS Nephew OS.
 */

:root {
  --bg-0: #0a0a0c;
  --bg-1: #131316;
  --bg-2: #1c1c21;
  --bg-3: #2a2a31;
  --fg-0: #f5f5f7;
  --fg-1: #c9c9d0;
  --fg-2: #8a8a95;
  --fg-3: #57575f;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.15);
  --warn: #fbbf24;
  --danger: #f87171;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --sidebar-w: 280px;
}

[data-theme="light"] {
  --bg-0: #fafaf9;
  --bg-1: #ffffff;
  --bg-2: #f1f1ef;
  --bg-3: #e6e6e3;
  --fg-0: #1c1c1e;
  --fg-1: #38383b;
  --fg-2: #6e6e75;
  --fg-3: #9d9da3;
  --accent: #059669;
  --accent-dim: rgba(5, 150, 105, 0.12);
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg-0); color: var(--fg-0);
  font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif; font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; }

.cassette-player {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* ─── Sidebar ───────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.18s ease, width 0.18s ease;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-w));
  width: 0;
  min-width: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand-glyph { font-size: 20px; color: var(--accent); }
.brand-name { font-weight: 600; font-size: 14px; }

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 12px;
}

.sidebar-section { padding: 8px 0; }
.sidebar-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-2);
  margin: 8px 14px 4px;
  font-weight: 600;
}
.sidebar-section ul { list-style: none; padding: 0; margin: 0; }

.sidebar-item {
  display: flex;
  align-items: stretch;
  margin: 0 6px;
  border-radius: 6px;
}
.sidebar-item:hover { background: var(--bg-2); }
.sidebar-item.active { background: var(--accent-dim); }
.sidebar-item.active .sidebar-item-main { color: var(--accent); }

.sidebar-item-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--fg-1);
  font-family: inherit;
  font-size: 13px;
  min-width: 0;
}
.sidebar-glyph { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-item-newtab {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--fg-3);
  text-decoration: none;
  font-size: 12px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.1s;
}
.sidebar-item:hover .sidebar-item-newtab { opacity: 1; }
.sidebar-item-newtab:hover { color: var(--accent); background: var(--bg-3); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-2);
}

.sidebar-empty { padding: 20px 14px; color: var(--fg-2); font-size: 12px; }

.auth-status {
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-pill {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-pill:hover { background: var(--bg-2); color: var(--fg-0); }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-1);
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: inherit;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-2); color: var(--fg-0); }
.icon-btn.hidden { display: none; }

.version-badge { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10px; color: var(--fg-3); }

/* ─── Main frame ─────────────────────────────────────────────── */

.main-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-0);
}

.main-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}

.main-breadcrumb {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-0);
}

.main-actions { display: flex; gap: 6px; }

.main-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.iframe-holder {
  flex: 1;
  position: relative;
  display: flex;
}
.iframe-holder iframe {
  flex: 1;
  border: none;
  background: var(--bg-0);
  width: 100%;
}
.iframe-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-1);
  padding: 32px;
  text-align: center;
  gap: 12px;
}
.iframe-fallback.hidden { display: none; }
.iframe-fallback h2 { margin: 0; }
.iframe-fallback code { background: var(--bg-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.open-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  gap: 14px;
}
.open-glyph { font-size: 56px; }
.open-panel h2 { margin: 0; }
.open-panel .url code { background: var(--bg-2); padding: 4px 8px; border-radius: 4px; font-size: 12px; }
.open-panel .hint { font-size: 12px; color: var(--fg-2); max-width: 480px; }

/* ─── Overview cassette ───────────────────────────────────────── */

.main-content > section.overview-section,
.main-content > section.overview-section:first-of-type {
  padding: 24px 28px;
}
.main-content {
  overflow-y: auto;
}
.overview-section { padding: 0 28px 28px; }
.overview-section:first-of-type { padding-top: 24px; }
.overview-section h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-2);
  margin: 0 0 12px;
  font-weight: 500;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.overview-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.08s, border-color 0.12s;
}
.overview-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.overview-card-header { display: flex; align-items: center; gap: 8px; }
.overview-glyph { font-size: 18px; width: 24px; text-align: center; }
.overview-title { font-weight: 600; flex: 1; }
.overview-newtab { color: var(--fg-3); text-decoration: none; padding: 2px 6px; }
.overview-newtab:hover { color: var(--accent); }
.overview-subtitle { color: var(--fg-2); font-size: 12px; line-height: 1.4; }
.overview-url { font-family: ui-monospace, monospace; font-size: 10px; color: var(--fg-3); word-break: break-all; }

/* ─── Login (no sidebar) ────────────────────────────────────────── */

.login-container {
  max-width: 380px;
  margin: 60px auto;
  padding: 32px 28px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.login-container h1 { margin: 0 0 4px; font-size: 22px; }
.login-container .subtitle { margin: 0 0 16px; color: var(--fg-2); font-size: 13px; }
.login-container .hint-msg { margin: 0 0 16px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; color: var(--fg-1); }
.login-container label { display: block; margin-bottom: 12px; }
.login-container label span { display: block; margin-bottom: 4px; font-size: 11px; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.04em; }
.login-container input { width: 100%; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--fg-0); font-size: 14px; font-family: inherit; }
.login-container input:focus { border-color: var(--accent); outline: none; }
.login-container button[type="submit"] { width: 100%; padding: 12px; background: var(--accent); border: none; border-radius: 6px; color: #04231a; font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit; margin-top: 6px; }
.login-container button[type="submit"]:disabled { opacity: 0.4; cursor: wait; }
.login-container .error { margin-top: 10px; padding: 8px 10px; background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.3); border-radius: 6px; color: var(--danger); font-size: 12px; }

/* ─── Profile modal ──────────────────────────────────────────── */

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal h2 { margin: 0; font-size: 16px; }
.modal-close { background: transparent; border: none; color: var(--fg-2); font-size: 22px; line-height: 1; padding: 0 6px; cursor: pointer; }
.modal-body { padding: 18px; }
.modal hr { border: none; border-top: 1px solid var(--border); margin: 8px 0 14px; }
.profile-section { margin-bottom: 16px; }
.profile-section h3 { margin: 12px 0 10px; font-size: 12px; text-transform: uppercase; color: var(--fg-2); letter-spacing: 0.04em; }
.profile-section label { display: block; margin-bottom: 12px; }
.profile-section label span { display: block; margin-bottom: 4px; font-size: 11px; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.04em; }
.profile-section input { width: 100%; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--fg-0); font-size: 13px; font-family: inherit; }
.profile-section input:disabled { color: var(--fg-3); background: var(--bg-1); }
button.primary { background: var(--accent); color: #04231a; border: none; border-radius: 6px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; }
button.primary:hover { opacity: 0.92; }
.hint-msg { padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--fg-1); }
.success { padding: 6px 10px; background: var(--accent-dim); color: var(--accent); border-radius: 6px; font-size: 12px; margin: 8px 0; }
.error { padding: 6px 10px; background: rgba(248,113,113,0.08); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); border-radius: 6px; font-size: 12px; margin: 8px 0; }

.loading { color: var(--fg-2); padding: 60px 0; text-align: center; }

/* ─── Mobile ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
  :root { --sidebar-w: 240px; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; }
  .sidebar:not(.collapsed) ~ .main-frame { opacity: 0.5; }
  .overview-grid { grid-template-columns: 1fr; }
}
/* ─── Hero login page (v1.37.1) ─────────────────────────────── */

.hero-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 32px 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(52,211,153,0.10), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(123,148,255,0.08), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

[data-theme="light"] .hero-shell {
  background:
    radial-gradient(circle at 30% 20%, rgba(5,150,105,0.08), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(99,102,241,0.06), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

.hero-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.4;
  pointer-events: none;
}

.hero-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.hero-mark {
  font-size: 84px;
  line-height: 1;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 24px rgba(52,211,153,0.18));
}

.hero-title {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-align: center;
  margin: 0;
  color: var(--fg-0);
}

.hero-subtitle {
  text-align: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-2);
  margin: 6px 0 36px;
}

.hero-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg-0);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.hero-input:focus {
  border-color: var(--accent);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.12);
}

[data-theme="light"] .hero-input:focus {
  box-shadow: 0 0 0 3px rgba(5,150,105,0.10);
}

.hero-submit {
  margin-top: 4px;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #04231a;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.06s;
}

.hero-submit:hover { opacity: 0.94; }
.hero-submit:active { transform: scale(0.99); }
.hero-submit:disabled { opacity: 0.4; cursor: wait; }

.hero-error {
  margin-top: 6px;
  padding: 10px 12px;
  background: rgba(248,113,113,0.07);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: 8px;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.hero-footer {
  position: absolute;
  right: 24px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

.hero-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(52,211,153,0.55);
  animation: hero-pulse 2.4s ease-in-out infinite;
}

@keyframes hero-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
}

.hero-theme {
  position: absolute;
  top: 22px;
  right: 24px;
}

@media (max-width: 480px) {
  .hero-mark { font-size: 64px; }
  .hero-title { font-size: 28px; }
  .hero-footer { right: 16px; bottom: 16px; }
}

/* ─── Hero mode: hide sidebar + main header entirely ──────────── */

body.hero-mode .sidebar,
body.hero-mode .main-header {
  display: none !important;
}

body.hero-mode .main-frame { width: 100%; }
body.hero-mode .main-content { overflow: hidden; }

/* v1.44.4 — changelog link in version badge */
.cl-link {
  color: inherit;
  opacity: 0.72;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  margin-left: 4px;
  font-size: 11px;
}
.cl-link:hover { opacity: 1; }
