@import url('themes.css');

body.hq { min-height: 100vh; }
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--accent-2);
  padding: 0.4rem 0.55rem 1rem;
  text-shadow: var(--glow);
}
.nav a {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  border-left: 3px solid transparent;
}
.nav a.active, .nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border-left-color: var(--accent);
  box-shadow: var(--glow);
}
.sidebar .hit {
  margin-top: auto;
  padding: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.main {
  padding: 1.25rem 1.5rem 2rem;
  background:
    radial-gradient(ellipse at top, rgba(255,255,255,0.03), transparent 45%),
    var(--bg);
  min-width: 0;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem; gap: 1rem;
}
.topbar h1 { margin: 0; font-weight: 600; font-size: 1.6rem; }
.topbar .countdown { font-size: 1.05rem; opacity: 0.95; }
.cards { display: grid; gap: 1rem; }
.cards.apps { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.card h3 { margin: 0.4rem 0 0.2rem; }
.meta { color: var(--muted); font-size: 0.85rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border);
  background: #111;
}
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  position: relative;
}
.login-wrap .bg {
  position: fixed; inset: 0; z-index: 0;
  background: #000 center/cover no-repeat;
  opacity: 0.25;
  filter: grayscale(0.4) brightness(0.6);
}
.login-card {
  position: relative; z-index: 1;
  width: min(380px, 92vw);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--glow);
  text-align: center;
}
.login-card .beanie { color: var(--accent); width: 42px; height: 42px; margin: 0 auto 0.4rem; }
.login-card h1 { margin: 0.2rem 0 0.8rem; }
.login-card .hint { color: var(--muted); font-size: 0.8rem; margin-top: 0.85rem; }
.login-card .countdown { font-size: 1.1rem; margin-bottom: 1rem; }
.error { color: var(--accent-2); background: rgba(225,29,46,0.12); border: 1px solid var(--danger); padding: 0.5rem 0.7rem; border-radius: 8px; margin-bottom: 0.75rem; }
.notes-grid {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 1rem;
  min-height: 70vh;
}
.list-item {
  padding: 0.7rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.list-item:hover, .list-item.active { border-color: var(--border); background: rgba(255,255,255,0.03); }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.toolbar button { padding: 0.35rem 0.55rem; box-shadow: none; }
.dropzone {
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  padding: 1.4rem;
  text-align: center;
  color: var(--muted);
  margin-bottom: 1rem;
  box-shadow: var(--glow);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.92rem; }
.progress {
  height: 8px; border-radius: 999px; border: 1px solid var(--border); overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--accent); box-shadow: var(--glow); }
.activity { font-size: 0.85rem; color: var(--muted); }
.activity li { margin: 0.4rem 0; }
.qr { width: 72px; height: 72px; background: #fff; border-radius: 6px; padding: 4px; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .notes-grid { grid-template-columns: 1fr; }
}

/* Minimal login */
body.login-minimal {
  overflow: hidden;
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
}
body.login-minimal .bg-wrap { z-index: 0; }
/* Login-only: make heli video ~25% opacity, still faint */
body.login-minimal .bg-wrap video,
body.login-minimal .bg-wrap img.poster {
  opacity: 0.25;
  filter: grayscale(0.25) contrast(1.08) brightness(0.82);
}
body.login-minimal .overlay {
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.72) 70%, rgba(0,0,0,0.88) 100%);
}
.login-bare {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(320px, 88vw);
  margin: 0;
}
.login-bare .login-input {
  width: 100%;
  background: rgba(4, 10, 18, 0.55);
  border: 1px solid rgba(165, 216, 255, 0.55);
  color: var(--text, #e8f4ff);
  caret-color: #A5D8FF;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  font-size: 1.05rem;
  text-align: center;
  letter-spacing: 0.08em;
  outline: none;
  box-shadow:
    0 0 0 1px rgba(74, 144, 226, 0.18),
    0 0 22px rgba(74, 144, 226, 0.35),
    inset 0 0 18px rgba(74, 144, 226, 0.08);
  transition: box-shadow .2s, border-color .2s, background .2s;
}
.login-bare .login-input:focus {
  border-color: rgba(165, 216, 255, 0.85);
  box-shadow:
    0 0 0 1px rgba(74, 144, 226, 0.35),
    0 0 28px rgba(74, 144, 226, 0.5),
    inset 0 0 20px rgba(74, 144, 226, 0.12);
}
.login-bare.fail .login-input {
  border-color: #ff3b4a;
  background: rgba(40, 4, 8, 0.6);
  box-shadow:
    0 0 0 1px rgba(225, 29, 46, 0.55),
    0 0 34px rgba(225, 29, 46, 0.75),
    0 0 64px rgba(225, 29, 46, 0.35),
    inset 0 0 22px rgba(225, 29, 46, 0.18);
}
@keyframes login-shake {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-10px); }
  30% { transform: translateX(10px); }
  45% { transform: translateX(-7px); }
  60% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
  90% { transform: translateX(4px); }
}
.login-bare.shake { animation: login-shake .42s ease; }

/* HUD */
.hud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  max-width: 1100px;
}
.hud-tile .hud-num {
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
  text-shadow: var(--glow);
  margin: 0.35rem 0;
}
.settings-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); max-width: 1100px; }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.kanban-col {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  min-height: 50vh;
}
.kanban-col h3 { margin: 0.2rem 0 0.6rem; font-size: 0.95rem; }
.task-card { margin-bottom: 0.55rem; cursor: grab; }
.task-card .progress-note { font-size: 0.8rem; color: var(--muted); margin: 0.35rem 0; }
.task-actions button { font-size: 0.75rem; padding: 0.35rem 0.45rem; }

/* Background picker */
.bg-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.55rem; }
.bg-thumb {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  border: 2px solid transparent; border-radius: 10px; padding: 0.25rem; cursor: pointer;
  font-size: 0.72rem; color: var(--muted); text-align: center;
}
.bg-thumb { position: relative; overflow: hidden; }
.bg-thumb input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px !important;
  height: 1px !important;
  margin: -1px;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.bg-thumb img, .bg-thumb .rotate-placeholder {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #111;
  display: grid; place-items: center; font-size: 1.6rem;
}
.bg-thumb.selected, .bg-thumb:has(input:checked) { border-color: var(--accent); box-shadow: var(--glow); }

/* Command palette */
.cmd-palette { position: fixed; inset: 0; z-index: 1000; }
.cmd-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.cmd-panel {
  position: relative; z-index: 1;
  width: min(560px, 94vw); margin: 12vh auto 0;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--glow); overflow: hidden;
}
.cmd-panel input {
  width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 1rem 1.1rem; font-size: 1.05rem; outline: none; border-bottom: 1px solid var(--border);
}
.cmd-panel ul { list-style: none; margin: 0; padding: 0.35rem; max-height: 50vh; overflow: auto; }
.cmd-panel li {
  padding: 0.65rem 0.75rem; border-radius: 8px; cursor: pointer; color: var(--muted);
}
.cmd-panel li[aria-selected="true"], .cmd-panel li:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.cmd-panel .type { font-size: 0.7rem; opacity: 0.7; margin-right: 0.4rem; text-transform: uppercase; }
.cmd-hint {
  margin: 0.5rem 0.55rem; background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 8px; padding: 0.35rem 0.5rem; cursor: pointer;
}

/* Mobile tabs */
.mobile-tabs {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--bg-panel); border-top: 1px solid var(--border);
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr); gap: 0.15rem;
}
.mobile-tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  color: var(--muted); font-size: 0.65rem; padding: 0.35rem; min-height: 48px; justify-content: center;
}
.mobile-tabs a.active { color: var(--accent-2); text-shadow: var(--glow); }
.mobile-tabs span { font-size: 1.1rem; }

.countdown .num { display: inline-block; transition: text-shadow .3s, transform .2s; }
body.ambient .countdown .num { text-shadow: 0 0 calc(var(--glow-strength, 50) * 0.25px) var(--accent); }
@keyframes digit-pulse { 0%,100%{opacity:1} 50%{opacity:.85} }
body.ambient .countdown .num { animation: digit-pulse 2s ease-in-out infinite; }

html[data-oled="1"] body.hq, html[data-oled="1"] body.public { --bg: #000; background: #000; }
html[data-auto-night="1"].night { filter: sepia(0.12) brightness(0.92) saturate(0.9); }

@media (prefers-reduced-motion: reduce) {
  body.ambient .countdown .num { animation: none; }
  .login-bare.shake { animation: none; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .layout { grid-template-columns: 1fr; }
  .main { padding-bottom: 5.5rem; }
  .mobile-tabs { display: grid; }
  .kanban { grid-template-columns: repeat(5, minmax(220px, 1fr)); }
  .topbar .countdown { font-size: 0.85rem; }
  .task-actions button { min-height: 40px; min-width: 44px; }
}


/* Visually hidden submit — required for reliable mobile Enter/Go submit */
.login-submit-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.login-hint {
  margin: 0 0 0.25rem;
  text-align: center;
  color: var(--text, #e8f4ff);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-shadow: 0 0 18px rgba(74, 144, 226, 0.45);
  position: relative;
  z-index: 2;
}
body.login-minimal {
  background: #05070b;
}


/* layout-fix-20261103 */
/* Single-line Mission board (and similar) buttons inside HUD tiles */
a.btn.hud-tile-btn,
.hud-tile a.btn,
.hud-tile .hud-tile-btn,
.hud-tile .btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  white-space: nowrap !important;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.15;
  margin-top: 0.45rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-tile p { margin: 0.45rem 0 0; }

/* Dashboard lower panels: two-col desktop, stacked mobile */
.hud-panels {
  grid-template-columns: 1fr 1fr;
  margin-top: 1rem;
  max-width: 1100px;
}
.workers-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
}
.files-layout {
  grid-template-columns: 1fr 1fr;
  max-width: 1000px;
}

/* Security / activity lines: wrap or truncate long IPv6 */
.activity { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.activity li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}
.activity .sec-line,
.activity .meta {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 900px) {
  .hud-panels,
  .files-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .workers-layout {
    grid-template-columns: 1fr;
  }
  a.btn.hud-tile-btn,
  .hud-tile a.btn,
  .hud-tile .hud-tile-btn,
  .hud-tile .btn {
    font-size: 0.78rem;
    padding: 0.38rem 0.6rem;
  }
  .main { overflow-x: hidden; }
  .table { display: block; overflow-x: auto; max-width: 100%; }
  .card, .hud-tile, .cards, .hud-panels, .settings-grid, .workers-layout, .files-layout { min-width: 0; max-width: 100%; }
  input, textarea, select { max-width: 100%; width: 100%; }
  .row { max-width: 100%; }
}

/* denser-layout-20261103d — fit 1280x800 */
.layout { grid-template-columns: 168px 1fr; }
.sidebar { padding: 0.65rem 0.5rem; gap: 0.2rem; }
.brand { padding: 0.25rem 0.4rem 0.55rem; gap: 0.4rem; }
.brand .beanie { width: 22px; height: 22px; }
.nav a { padding: 0.42rem 0.55rem; font-size: 0.88rem; border-radius: 6px; }
.sidebar .hit { padding: 0.45rem; font-size: 0.75rem; }
.main { padding: 0.75rem 0.95rem 1.1rem; }
.topbar { margin-bottom: 0.65rem; }
.topbar h1 { font-size: 1.2rem; }
.card { padding: 0.65rem 0.75rem; border-radius: 9px; }
.cards { gap: 0.55rem; }
.meta { font-size: 0.78rem; }
.avatar { width: 42px; height: 42px; }
.hud-grid { gap: 0.55rem; max-width: 100%; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.hud-tile .hud-num { font-size: 1.55rem; margin: 0.15rem 0; }
.hud-panels { margin-top: 0.65rem; gap: 0.55rem; max-width: 100%; }
.hud-panels .card h3 { font-size: 0.92rem; margin: 0 0 0.3rem; }
.activity li { margin: 0.22rem 0; font-size: 0.8rem; }
.settings-grid { gap: 0.55rem; max-width: 100%; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.bg-picker { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.35rem; }
.bg-thumb { padding: 0.15rem; font-size: 0.62rem; border-radius: 7px; }
.bg-thumb img, .bg-thumb .rotate-placeholder {
  aspect-ratio: 16/9; border-radius: 5px; font-size: 1rem; max-height: 48px;
}
.kanban { gap: 0.45rem; padding-bottom: 0.4rem; grid-template-columns: repeat(6, minmax(140px, 1fr)); }
.kanban-6 { grid-template-columns: repeat(6, minmax(140px, 1fr)); }
.kanban-col { padding: 0.4rem; border-radius: 9px; min-height: 42vh; }
.kanban-col h3 { margin: 0.1rem 0 0.35rem; font-size: 0.82rem; }
.task-card { margin-bottom: 0.35rem; padding: 0.45rem 0.5rem; }
.task-card strong { font-size: 0.86rem; }
.task-actions button { font-size: 0.68rem; padding: 0.22rem 0.35rem; }
.workers-layout { gap: 0.55rem; grid-template-columns: 1fr 240px; }
.notes-grid, .notes-layout {
  display: grid;
  grid-template-columns: 160px 200px 1fr 220px;
  gap: 0.55rem;
  min-height: calc(100vh - 110px);
  max-height: calc(100vh - 90px);
}
.note-editor {
  min-height: 160px; max-height: calc(100vh - 280px); overflow: auto;
  margin-top: 0.35rem; padding: 0.55rem; border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.list-item { padding: 0.4rem 0.5rem; }
.toolbar { gap: 0.25rem; margin-bottom: 0.4rem; }
.toolbar button { padding: 0.25rem 0.4rem; font-size: 0.78rem; }
.notebook-list { list-style: none; margin: 0.45rem 0 0; padding: 0; }
.notebook-item {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.4rem; border-radius: 6px; cursor: pointer; color: var(--muted);
}
.notebook-item.active, .notebook-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nb-swatch { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.nb-label { flex: 1; font-size: 0.82rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-actions button { padding: 0.15rem 0.3rem; font-size: 0.7rem; }
.avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.avatar-edit-btn { font-size: 0.68rem; padding: 0.2rem 0.35rem; }
.hq-dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 1rem;
  background: var(--bg-elev); color: var(--text); width: min(440px, 94vw);
  box-shadow: var(--glow);
}
.hq-dialog::backdrop { background: rgba(0,0,0,0.55); }
.hq-dialog label.meta { display: block; margin: 0.45rem 0 0.15rem; }
.hq-dialog input, .hq-dialog textarea, .hq-dialog select { width: 100%; }
.avatar-crop-ui { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.avatar-crop-ui canvas {
  border-radius: 50%; border: 1px solid var(--border); background: #111; cursor: grab; max-width: 100%;
}
.log-filters { padding: 0.55rem 0.7rem; }
.log-table td, .log-table th { padding: 0.35rem 0.35rem; font-size: 0.8rem; }
.pri { text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.04em; }
.pri-urgent { color: #ff5a6a; }
.pri-high { color: #ffb020; }
.pri-normal { color: var(--muted); }
.pri-low { color: var(--muted); opacity: 0.75; }
.danger-btn { border-color: var(--danger, #e11d2e); color: #ff8a95; }
a.btn, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.35rem 0.55rem; border-radius: 7px; border: 1px solid var(--border);
  color: var(--text); background: transparent; text-decoration: none; font-size: 0.8rem; cursor: pointer;
}
@media (max-width: 1100px) {
  .notes-layout { grid-template-columns: 140px 1fr 200px; }
  .todo-pane { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .notes-layout { grid-template-columns: 1fr; max-height: none; }
  .kanban, .kanban-6 { grid-template-columns: repeat(6, minmax(180px, 1fr)); }
}
