/* FISH HUB — 設計語言繼承自 /home/ubuntu/site（MH Study 暗色控制台）。
   改樣式：改呢個檔。tokens 同 ubuntu site 一致。 */

/* ── tokens ─────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg: #101416;
  --sidebar: #13181a;
  --surface: #191e21;
  --surface-2: #20272a;
  --surface-hover: #252e31;
  --text: #eef1ec;
  --text-2: #aab5b4;
  --text-3: #899796;
  --accent: #b3e1c4;
  --accent-strong: #81cba7;
  --accent-soft: #243b31;
  --accent-ink: #193127;
  --border: #2a3235;
  --border-strong: #465551;
  --danger: #f2a3a0;
  --danger-soft: #382a2b;
  --warning: #e9ca8d;
  --warning-soft: #353128;
  --success: #a5d6b6;
  --radius: 16px;
  --radius-sm: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --sidebar-width: 80px;
  --header-height: 68px;
  --bottom-height: 64px;
  --page-padding: 20px;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --course: var(--accent);
}

/* ── base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body,
h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}
ul,
ol {
  padding-left: 18px;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 20px);
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button {
  border: 0;
  color: inherit;
  cursor: pointer;
  background: none;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
select {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 46px;
  padding: 10px 12px;
  font-size: 16px;
  width: 100%;
  min-width: 0;
}
select {
  padding-right: 28px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1:focus,
main:focus {
  outline: none;
}
h1 {
  font-size: 32px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -1.1px;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}
h3 {
  font-size: 14px;
  font-weight: 550;
}
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-150%);
  border-radius: 8px;
}
.skip-link:focus {
  transform: translateY(0);
}
.muted {
  color: var(--text-2);
}
.small {
  font-size: 12px;
}
.full-width {
  width: 100%;
}
body:has(dialog[open]) {
  overflow: hidden;
}
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── shell：sidebar / topbar / mobile nav ───────────── */
.sidebar {
  display: none;
}
.app-body {
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-height);
  padding: calc(10px + env(safe-area-inset-top))
    max(var(--page-padding), env(safe-area-inset-right)) 10px
    max(var(--page-padding), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.breadcrumb {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}
.desktop-crumb {
  display: none;
  color: var(--text-3);
}
.crumb-divider {
  margin: 0 4px 0 16px;
  color: var(--border-strong);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 44px;
  min-height: 44px;
  color: var(--text-3);
}
.search-hint,
kbd {
  display: none;
}
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #303932;
  color: #cbd5c6;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #434d41;
}
.avatar-small {
  width: 32px;
  height: 32px;
}
.fish-avatar {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}
main {
  padding: 28px max(var(--page-padding), env(safe-area-inset-right))
    calc(var(--bottom-height) + env(safe-area-inset-bottom) + 24px)
    max(var(--page-padding), env(safe-area-inset-left));
  max-width: 1480px;
  margin: 0 auto;
}
#view {
  min-width: 0;
  min-height: 60vh;
}
.bottom-nav {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: calc(var(--bottom-height) + env(safe-area-inset-bottom));
  padding: 6px max(8px, env(safe-area-inset-right))
    calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--sidebar);
  border-top: 1px solid var(--border);
}
.bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 10px;
  min-height: 50px;
  border-radius: 10px;
  position: relative;
}
.bottom-item .icon {
  width: 21px;
  height: 21px;
}
.bottom-item.active {
  color: var(--accent);
}
.bottom-item.active::before {
  content: "";
  position: absolute;
  width: 34px;
  height: 28px;
  top: 2px;
  border-radius: 8px;
  background: var(--accent-soft);
  z-index: -1;
}
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-3);
  font-size: 10px;
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding-top: 20px;
}
.footer-dot {
  margin: 0 7px;
}
.brand {
  display: flex;
  align-items: center;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 12px;
  font-size: 23px;
  letter-spacing: -3px;
  color: var(--accent-ink);
  font-weight: 750;
  line-height: 1;
  padding-right: 3px;
  flex-shrink: 0;
}
.brand-mark.fish-mark {
  font-size: 21px;
  letter-spacing: 0;
  padding: 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-radius: 10px;
  color: var(--text-2);
  padding: 10px 12px;
  font-size: 13px;
}
.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-count {
  margin-left: auto;
  background: #344c40;
  border-radius: 6px;
  font-family: var(--mono);
  padding: 0 6px;
  font-size: 10px;
  line-height: 20px;
}
@media (min-width: 700px) {
  :root {
    --page-padding: 24px;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 28px 12px 16px;
    padding-top: max(28px, env(safe-area-inset-top));
  }
  .sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
  }
  .brand-copy,
  .sidebar-label,
  .sidebar .nav-count,
  .profile > div,
  .online-dot {
    display: none;
  }
  .sidebar .nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px 0;
    min-height: 58px;
    margin-bottom: 6px;
  }
  .sidebar .nav-text {
    display: block;
    font-size: 9px;
    white-space: nowrap;
  }
  .sidebar {
    overflow-y: auto;
  }
  .sidebar-bottom {
    margin-top: auto;
  }
  .profile {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
  }
  .app-body {
    margin-left: var(--sidebar-width);
  }
  .bottom-nav {
    display: none;
  }
  .desktop-crumb {
    display: inline;
  }
  main {
    padding-bottom: 28px;
  }
  .search-hint,
  kbd {
    display: inline;
  }
  .topbar-search {
    font-size: 11px;
  }
}
@media (min-width: 1200px) {
  :root {
    --sidebar-width: 224px;
    --page-padding: 36px;
  }
  .sidebar {
    padding: 32px 16px 20px;
  }
  .sidebar .brand {
    justify-content: flex-start;
    margin: 0 0 40px 4px;
  }
  .brand-copy {
    display: block;
    font-size: 18px;
    letter-spacing: -0.4px;
    font-weight: 600;
  }
  .brand-copy b {
    font-weight: 400;
  }
  .brand-copy small {
    display: block;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-3);
    margin-top: 5px;
  }
  .sidebar-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.8px;
    color: var(--text-3);
    margin: 0 12px 14px;
  }
  .sidebar .nav-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
  }
  .sidebar .nav-text {
    font-size: 13px;
  }
  .profile {
    justify-content: flex-start;
    gap: 10px;
    margin: 20px 6px 0;
  }
  .profile > div {
    display: block;
    font-size: 11px;
  }
  .profile small {
    display: block;
    font-size: 9px;
    color: var(--text-3);
    margin-top: 3px;
  }
  .online-dot {
    display: block;
    width: 6px;
    height: 6px;
    background: var(--accent-strong);
    border-radius: 50%;
    align-self: center;
    margin-left: auto;
  }
}
@media (max-width: 359px) {
  :root {
    --page-padding: 14px;
  }
}

/* ── components ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header .page-body {
  min-width: 0;
}
.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 550;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}
.eyebrow-line {
  height: 1px;
  width: 16px;
  background: var(--border-strong);
}
.page-description {
  color: var(--text-2);
  font-size: 12px;
  margin-top: 10px;
}
.button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.button .icon {
  width: 17px;
  height: 17px;
}
.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.button.secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  color: var(--text-2);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  flex-wrap: wrap;
}
.section-heading h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.section-heading h2 .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  min-width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 400;
  font-family: var(--mono);
}
.text-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-2);
  white-space: nowrap;
  margin: -10px 0;
}
.text-link .icon {
  width: 13px;
  height: 13px;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 8px;
}
.empty-icon {
  width: 44px;
  height: 44px;
  background: var(--surface-2);
  color: var(--accent);
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.empty-state p {
  max-width: 300px;
  font-size: 12px;
  color: var(--text-3);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 10px;
  color: var(--text-2);
  white-space: nowrap;
  font-family: var(--mono);
}
.chip.b-ok {
  color: var(--success);
  border-color: #355d49;
  background: #1c2f26;
}
.chip.b-no {
  color: var(--danger);
  border-color: #5d3838;
  background: var(--danger-soft);
}
.chip.b-mnt {
  color: #8fb8e8;
  border-color: #3d5270;
  background: #1d2836;
}
.chip.b-info {
  color: var(--warning);
  border-color: #5c4b2c;
  background: var(--warning-soft);
}
.chip.b-empty {
  color: var(--text-3);
  border-style: dashed;
}
.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-3);
  font-size: 10px;
}
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 10px;
  white-space: nowrap;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 11px;
  min-height: 44px;
  margin: -10px 0 16px;
}
.back-link .icon {
  width: 16px;
  height: 16px;
}
.tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  scrollbar-width: thin;
}
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--text-3);
  font-size: 12px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab > span {
  font-size: 10px;
  color: var(--text-3);
}
.tab .icon {
  width: 16px;
  height: 16px;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #456652;
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}
.back-link:hover,
.text-link:hover,
.topbar-search:hover,
.pill:hover {
  color: var(--accent);
}
.course-card:hover,
.session-row:hover,
.material-row:hover,
.docs-row:hover {
  background: var(--surface-2);
}

/* ── identity / overview ────────────────────────────── */
.identity-hero {
  position: relative;
  border: 1px solid #3a5146;
  border-radius: var(--radius);
  background: linear-gradient(115deg, #23372d, #1d2b27 70%, #253930);
  overflow: hidden;
  padding: 22px;
  margin-bottom: 24px;
}
.identity-hero::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -95px;
  top: -100px;
  border: 1px solid #b3e1c413;
  border-radius: 50%;
  box-shadow:
    0 0 0 28px #b3e1c405,
    0 0 0 56px #b3e1c404;
  pointer-events: none;
}
.hero-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.hero-stamp {
  font: 700 12px var(--mono);
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid #52705f;
  background: #1a2b22;
  border-radius: 8px;
  padding: 7px 12px;
}
.hero-port {
  margin-left: auto;
  color: var(--accent);
  border: 1px solid #52705f;
  border-radius: 999px;
  padding: 5px 10px;
  font: 700 9px var(--mono);
  letter-spacing: .08em;
}
.hero-boundary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #efb0ac;
  background: rgba(56, 42, 43, .72);
  border: 1px solid rgba(242, 163, 160, .22);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 18px;
}
.boundary-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #2b1718;
  font: 800 12px var(--mono);
}
.hero-boundary strong,
.hero-boundary span { display: block; }
.hero-boundary strong { font-size: 11px; margin-bottom: 2px; }
.hero-boundary div > span { color: #d9aaa7; font-size: 11.5px; }
.machine-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.machine {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  border: 1px solid #40584b;
  border-radius: 12px;
  padding: 15px;
  background: rgba(16, 20, 22, 0.65);
  min-width: 0;
}
.machine .emoji {
  font-size: 27px;
  line-height: 1;
}
.machine .tag {
  font: 9px var(--mono);
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-transform: uppercase;
}
.machine .name {
  font-size: 16px;
  font-weight: 750;
  margin: 3px 0 4px;
}
.machine .desc {
  color: var(--text-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.machine.owner {
  border-color: #52705f;
}
.machine.limited {
  border-color: #5c4b2c;
}
.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 0;
  margin-bottom: 24px;
}
.overview-stats > a {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.overview-stats > a:last-child {
  border-right: 0;
}
.stat-icon {
  color: var(--text-3);
}
.stat-icon .icon {
  width: 22px;
  height: 22px;
}
.overview-stats strong {
  display: block;
  font-size: 25px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.7px;
}
.overview-stats strong small {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-3);
  margin-left: 5px;
}
.overview-stats div > span {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 5px;
}
.dashboard-grid {
  display: grid;
  gap: 20px;
}
.dashboard-primary,
.dashboard-secondary {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.zone-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.zone-preview-group {
  min-width: 0;
  background: var(--surface);
  padding: 17px 20px 10px;
}
.zone-preview-title {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 9px;
  margin-bottom: 8px;
}
.zone-preview-title h3 { font-size: 13px; }
.zone-preview-title small {
  grid-column: 2;
  color: var(--text-3);
  font-size: 10px;
}
.zone-signal {
  grid-row: 1 / 3;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(129, 203, 167, .08);
}
.zone-signal.local { background: var(--accent-strong); }
.zone-signal.remote { background: var(--warning); }
.zone-preview-row {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}
.zone-preview-row code {
  color: var(--accent-strong);
  font: 10.5px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.zone-preview-row span {
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.55;
}
.panel-action { padding: 14px 20px 17px; }
@media (min-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  }
}
@media (max-width: 760px) {
  .machine-grid,
  .zone-mini-grid {
    grid-template-columns: 1fr;
  }
}

/* ── tables / zone map / rules ──────────────────────── */
.table-wrap {
  padding: 4px 20px 18px;
}
table.zone-table {
  width: 100%;
  border-collapse: collapse;
}
table.zone-table th,
table.zone-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: top;
}
table.zone-table th {
  font: 9px var(--mono);
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-transform: uppercase;
  padding-top: 0;
}
table.zone-table tr:last-child td {
  border-bottom: 0;
}
td.path {
  font: 12px var(--mono);
  color: var(--accent-strong);
  white-space: nowrap;
}
td.zd {
  color: var(--text-2);
}
.zone-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.rule-list {
  padding: 6px 20px 16px;
}
.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.rule-item:last-child {
  border-bottom: 0;
}
.rule-num {
  font: 700 13px var(--mono);
  color: var(--accent-strong);
  min-width: 28px;
  padding-top: 1px;
}
.rule-item .rt {
  font-size: 13.5px;
  font-weight: 550;
}
.rule-item .rd {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 3px;
}
.rule-item .rbadge {
  margin-left: auto;
  flex-shrink: 0;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 16px;
}
.kv-cell {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.kv-cell .k {
  font: 9px var(--mono);
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-transform: uppercase;
}
.kv-cell .v {
  font: 12px var(--mono);
  color: var(--accent-strong);
  margin-top: 4px;
  word-break: break-all;
}
.kv-cell .v.warn {
  color: var(--warning);
}
.code-block {
  margin: 0;
  background: #0b0f0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  font: 12px/1.6 var(--mono);
  overflow-x: auto;
  color: #b9d9c4;
  white-space: pre-wrap;
  word-break: break-word;
}
.steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 20px 18px;
}
.step-card h3 {
  font-size: 13px;
  margin-bottom: 8px;
}
.status-list {
  padding: 4px 20px 10px;
}
.status-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.status-row:last-child {
  border-bottom: 0;
}
.status-row .emoji {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.code-card {
  margin: 0 20px 18px;
}
.code-card h3 {
  font-size: 13px;
  margin-bottom: 10px;
}

/* ── MOT：course cards / files ──────────────────────── */
.mot-bundle {
  position: relative;
  display: block;
  border: 1px solid #3a5146;
  border-radius: var(--radius);
  background: linear-gradient(115deg, #1d2b27, #22362c 70%, #1e2d29);
  overflow: hidden;
  padding: 20px 22px;
  margin-bottom: 24px;
}
.mot-bundle::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -80px;
  border: 1px solid #b3e1c413;
  border-radius: 50%;
  box-shadow:
    0 0 0 24px #b3e1c405,
    0 0 0 48px #b3e1c404;
  pointer-events: none;
}
.bundle-in {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  min-width: 0;
}
.bundle-in > div {
  min-width: 0;
  flex: 1;
}
.bundle-code {
  font: 10px var(--mono);
  color: #b4c8ba;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.bundle-code .live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px #b3e1c412;
}
.bundle-in h2 {
  font-size: 20px;
  font-weight: 550;
  letter-spacing: -0.4px;
  margin: 6px 0;
}
.bundle-in p {
  color: #b2c5b8;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.bundle-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.course-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.course-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.course-symbol {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 44px;
  height: 48px;
  flex-shrink: 0;
  color: var(--course, var(--accent));
  font: 700 14px var(--mono);
}
.course-body {
  min-width: 0;
  flex: 1;
}
.course-code {
  font: 10px var(--mono);
  color: var(--text-3);
  letter-spacing: 0.4px;
  margin-bottom: 5px;
}
.course-card h3 {
  font-size: 15px;
}
.course-english {
  color: var(--text-3);
  font-size: 11px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.course-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}
.course-stats .chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.course-arrow {
  color: var(--text-3);
  flex-shrink: 0;
}
.course-arrow .icon {
  width: 14px;
  height: 14px;
}
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 20px;
}
.file-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}
.file-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent-strong);
  font: 9px var(--mono);
  letter-spacing: 0.04em;
}
.file-type.docx {
  color: #8fb8e8;
}
.file-body {
  flex: 1;
  min-width: 0;
}
.file-name {
  font-size: 12.5px;
  font-weight: 520;
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
}
.file-name:hover {
  color: var(--accent);
}
.file-body .row-meta {
  margin-top: 5px;
}
.file-row .button {
  flex-shrink: 0;
}
.course-detail-header {
  display: flex;
  gap: 18px;
  align-items: center;
}
.course-detail-header .course-symbol {
  width: 62px;
  height: 70px;
  border-radius: 15px;
  font-size: 18px;
}
.course-detail-header p {
  color: var(--text-2);
  font-size: 12px;
  margin-top: 7px;
  overflow-wrap: anywhere;
}
.detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 20px 0;
  font-size: 11px;
  color: var(--text-3);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  margin-bottom: 18px;
}
.search-box:focus-within {
  border-color: var(--accent);
}
.search-box > .icon {
  color: var(--accent);
  width: 18px;
  height: 18px;
}
.search-box input {
  border: 0;
  background: transparent;
  padding: 8px 0;
  outline: none;
}
.group-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.group-list .file-list {
  padding-top: 8px;
}
.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 8px;
  flex-wrap: wrap;
}
.group-header h2 {
  font-size: 13px;
  font-weight: 600;
  margin-right: auto;
}
.group-header .course-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--course, var(--accent));
  flex-shrink: 0;
}
.file-grid-note {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

/* ── handover docs / dialogs / toast ────────────────── */
.docs-list {
  padding: 0 20px 10px;
}
.docs-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.docs-row:last-child {
  border-bottom: 0;
}
.docs-row > .icon {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  flex-shrink: 0;
}
.docs-row > div {
  flex: 1;
  min-width: 0;
}
.docs-row strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
}
.docs-row span {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
}
.docs-row > .button {
  flex-shrink: 0;
}
.security-note {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.7;
}
.prose {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
dialog {
  background: var(--surface);
  color: var(--text);
  width: calc(100% - 32px);
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 80px #0008;
}
dialog::backdrop {
  background: #060a0cbf;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.dialog-header h2 {
  font-size: 22px;
}
.sheet {
  margin: auto 0 0;
  width: 100%;
  max-width: none;
  border-radius: 22px 22px 0 0;
  padding: 20px 24px max(24px, env(safe-area-inset-bottom));
}
.sheet-handle {
  width: 32px;
  height: 4px;
  border-radius: 4px;
  background: var(--border-strong);
  margin: -8px auto 20px;
}
.sheet .nav-link {
  min-height: 56px;
}
@media (min-width: 700px) {
  .sheet {
    width: 420px;
    margin: auto;
    border-radius: 20px;
  }
}
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover,
  .bottom-item:hover,
  .icon-button:hover,
  .tab:hover,
  .file-row:hover,
  .course-card:hover {
    background: var(--surface-hover);
    color: var(--text);
  }
  .button:hover {
    filter: brightness(1.08);
  }
}

/* ── responsive tweaks ──────────────────────────────── */
@media (min-width: 540px) {
  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1400px) {
  .course-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 499px) {
  h1 {
    font-size: 27px;
  }
  .overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
  }
  .overview-stats > a { justify-content: flex-start; padding: 14px 16px; }
  .overview-stats > a:nth-child(2) { border-right: 0; }
  .overview-stats > a:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .stat-icon {
    display: none;
  }
  .overview-stats strong {
    font-size: 22px;
  }
  .overview-stats div > span {
    font-size: 9px;
  }
  .file-row {
    flex-wrap: wrap;
  }
  .file-row .button {
    width: 100%;
  }
  .bundle-in {
    flex-direction: column;
    align-items: flex-start;
  }
  .bundle-actions {
    width: 100%;
  }
  .bundle-actions .button {
    flex: 1;
  }
  .identity-hero {
    padding: 15px;
  }
  .hero-port {
    margin-left: 0;
  }
  table.zone-table td.path {
    white-space: normal;
    word-break: break-all;
  }
}

/* ── 日程（今日總覽／日程總覽） ─────────────────────── */
.event-list {
  display: flex;
  flex-direction: column;
  padding: 4px 20px 14px;
}
.event-empty {
  color: var(--text-3);
  font-size: 12.5px;
  padding: 14px 2px;
  line-height: 1.7;
}
.event-empty a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.event-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.event-row:last-child {
  border-bottom: 0;
}
.event-row.past {
  opacity: 0.52;
}
.days-badge {
  flex-shrink: 0;
  min-width: 58px;
  text-align: center;
  margin-top: 2px;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font: 10px var(--mono);
  white-space: nowrap;
}
.days-badge.today {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.days-badge.soon {
  color: var(--warning);
  border-color: #5c4b2c;
  background: var(--warning-soft);
}
.days-badge.past {
  opacity: 0.8;
}
.event-body {
  min-width: 0;
  flex: 1;
}
.event-title {
  display: block;
  font-size: 13px;
  font-weight: 550;
  margin-top: 5px;
  overflow-wrap: anywhere;
  line-height: 1.55;
}
.event-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.chip.t-lecture {
  color: #9fc3ef;
  border-color: #3d5270;
  background: #1c2836;
}
.chip.t-assignment {
  color: var(--warning);
  border-color: #5c4b2c;
  background: var(--warning-soft);
}
.chip.t-quiz {
  color: var(--success);
  border-color: #355d49;
  background: #1c2f26;
}
.chip.t-presentation {
  color: #c7a7e8;
  border-color: #543f6b;
  background: #2a2036;
}
.chip.t-exam {
  color: var(--danger);
  border-color: #5d3838;
  background: var(--danger-soft);
}
.chip.c-course {
  background: transparent;
  border-style: solid;
}
.schedule-month {
  font: 600 12px var(--mono);
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 18px 2px 10px;
}
.schedule-month:first-child {
  margin-top: 2px;
}
.footer-actions {
  display: inline-flex;
  gap: 14px;
  align-items: center;
}
.footer-backend {
  color: var(--text-3);
  font-size: 10px;
  padding: 2px 7px;
  border: 1px dashed var(--border-strong);
  border-radius: 5px;
  letter-spacing: 0.06em;
  transition: color 120ms;
}
.footer-backend:hover {
  color: var(--accent);
  border-style: solid;
}
@media (max-width: 499px) {
  .days-badge {
    min-width: 48px;
    font-size: 9px;
  }
  .event-row {
    gap: 10px;
  }
}

@media (max-width: 699px) {
  .page-header { margin-bottom: 24px; }
  .identity-hero { margin-bottom: 16px; }
  .hero-top { align-items: flex-start; }
  .hero-stamp { max-width: 100%; line-height: 1.55; }
  .machine { padding: 14px; }
  .machine .emoji { font-size: 23px; }
  .machine .name { font-size: 15px; }
  .machine .desc { font-size: 11.5px; }
  .zone-mini-grid { grid-template-columns: 1fr; }
  .zone-preview-row { grid-template-columns: 1fr; gap: 3px; }
  .zone-stack .panel { overflow: hidden; }
  .zone-stack .section-heading { align-items: flex-start; flex-direction: column; }
  .zone-stack .section-heading .tag { white-space: normal; }
  .zone-stack .table-wrap { padding: 0 15px 12px; }
  .zone-stack table.zone-table,
  .zone-stack table.zone-table tbody,
  .zone-stack table.zone-table tr,
  .zone-stack table.zone-table td { display: block; width: 100%; }
  .zone-stack table.zone-table tr:first-child { display: none; }
  .zone-stack table.zone-table tr { padding: 13px 0; border-bottom: 1px solid var(--border); }
  .zone-stack table.zone-table tr:last-child { border-bottom: 0; }
  .zone-stack table.zone-table td { border: 0; padding: 2px 0; }
  .zone-stack table.zone-table td.path { font-size: 11.5px; word-break: break-word; }
  .zone-stack table.zone-table td.zd { font-size: 11.5px; padding: 5px 0 8px; }
}
