@font-face {
  font-family: "Jua";
  src: url("/fonts/Jua/Jua-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans KR";
  src: url("/fonts/NotoSansKR/NotoSansKR-VariableFont_wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

/* XIXSXIX Web Portal — Shared Design System */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-raised: #ffffff;
  --header: rgba(255, 255, 255, .92);
  --text: #172033;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #dfe5ec;
  --line-strong: #ccd5e1;
  --control: #eef2f6;
  --accent: #2563eb;
  --accent-soft: #eaf2ff;
  --accent-strong: #1d4ed8;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #a16207;
  --warning-soft: #fef3c7;
  --danger: #b42318;
  --danger-soft: #fee2e2;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, .08);
  --max-width: 1280px;
  --font-body: "Noto Sans KR", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  --font-display: "Jua", "Noto Sans KR", sans-serif;
}

html[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #121b2d;
  --surface-soft: #172236;
  --surface-raised: #18243a;
  --header: rgba(11, 17, 32, .94);
  --text: #edf2f8;
  --muted: #a9b4c5;
  --subtle: #77849a;
  --line: #26344a;
  --line-strong: #35465f;
  --control: #1d2a40;
  --accent: #60a5fa;
  --accent-soft: #172d4d;
  --accent-strong: #93c5fd;
  --success: #6ee7a0;
  --success-soft: #123624;
  --warning: #facc6b;
  --warning-soft: #3b2d12;
  --danger: #fda29b;
  --danger-soft: #411f25;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .18);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, .28);
}


* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 28px 18px 60px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }


/* Unified application shell */
body {
  min-width: 320px;
  font-size: 16px;
  transition: background-color .2s ease, color .2s ease;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: calc(100% + 36px);
  margin: -28px -18px 0;
  background: var(--header);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.app-header-inner {
  width: min(var(--max-width), calc(100% - 48px));
  min-height: 70px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}
.app-brand {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.48rem;
  font-weight: 400;
  letter-spacing: .06em;
  line-height: 1;
}
.app-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.app-nav a {
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.app-nav a:hover {
  color: var(--text);
  background: var(--surface-soft);
}
.app-nav a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-size: 1.05rem;
  line-height: 1;
}
.theme-toggle:hover {
  transform: none;
  border-color: var(--line-strong);
  background: var(--surface-soft);
}
.page-shell {
  width: min(var(--max-width), 100%);
  margin: 0 auto;
  padding: 38px 0 60px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.page-header {
  margin-bottom: 26px;
}
.page-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .12em;
}
.page-header h1, .header h1, .portal-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0;
}
.page-subtitle, .header p, .subtitle, .portal-intro > p:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.65;
}
button, input, select { color-scheme: inherit; }
.button, button {
  background: var(--control);
  color: var(--text);
}
.button:hover, button:hover { background: var(--surface-soft); }
input, select {
  min-height: 42px;
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.summary-card, .stream-card, .editor, .event-card, .router-card, .table-wrap {
  background: var(--surface);
  border-color: var(--line);
}
table, thead { background: var(--surface); }
thead { background: var(--surface-soft); }
th, td { border-color: var(--line); }
.filename, .destination, .meta span, .router-path, .router-reason {
  background: var(--surface-soft);
}
html[data-theme="dark"] .day,
html[data-theme="dark"] .stream-card-tools .icon-button:hover {
  background: var(--control);
  color: var(--muted);
}
html[data-theme="dark"] .day.active { background: var(--accent); color: #07111f; }
html[data-theme="dark"] .portal-card--primary {
  border-color: #2f4770;
  background: linear-gradient(145deg, var(--surface) 40%, #142743);
}
html[data-theme="dark"] .portal-search-control,
html[data-theme="dark"] .portal-card,
html[data-theme="dark"] .portal-section {
  background-color: var(--surface);
  border-color: var(--line);
}
html[data-theme="dark"] .portal-section { background: rgba(18, 27, 45, .7); }
html[data-theme="dark"] .portal-card-icon { background: var(--control); color: var(--text); }
html[data-theme="dark"] .portal-card--primary .portal-card-icon {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
html[data-theme="dark"] .error { color: var(--danger); background: var(--danger-soft); }
html[data-theme="dark"] .router-card-head { background: var(--surface-soft); border-color: var(--line); }
html[data-theme="dark"] .router-badge.event-badge,
html[data-theme="dark"] .router-badge.result-skipped { background: var(--control); color: var(--muted); }
html[data-theme="dark"] .header-logout { color: var(--muted); }
html[data-theme="dark"] .header-logout:hover { background: var(--control); color: var(--text); }
html[data-theme="dark"] select,
html[data-theme="dark"] input {
  background-color: var(--surface-soft);
  color: var(--text);
  border-color: var(--line-strong);
  -webkit-text-fill-color: var(--text);
}
html[data-theme="dark"] select option,
html[data-theme="dark"] select optgroup {
  background-color: #172236;
  color: #edf2f8;
}
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] input:disabled {
  color: var(--subtle);
  -webkit-text-fill-color: var(--subtle);
  opacity: 1;
}
html[data-theme="dark"] button:not(.primary):not(.button-primary):not(.theme-toggle),
html[data-theme="dark"] .button:not(.button-primary) {
  background-color: var(--control);
  color: var(--text);
  border-color: var(--line-strong);
  -webkit-text-fill-color: var(--text);
}
html[data-theme="dark"] button:not(.primary):not(.button-primary):not(.theme-toggle):hover,
html[data-theme="dark"] .button:not(.button-primary):hover {
  background-color: var(--surface-soft);
  border-color: var(--accent);
}
html[data-theme="dark"] .header-logout {
  background-color: var(--control);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
html[data-theme="dark"] .header-logout svg {
  stroke: currentColor;
}
html[data-theme="dark"] .header-logout:hover {
  background-color: var(--surface-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* Shared typography scale */
.portal-card-name,
.summary-label,
.stream-name,
.router-bundle {
  font-size: .9375rem;
}
.portal-card-description,
.portal-section-title p,
.portal-section-title span,
.status,
.updated,
.event-time,
.type,
.badge,
.meta span,
.filename-label,
.destination-label,
.stream-meta,
.stream-profile,
.stream-countdown,
.day,
.router-filter label,
.router-meta,
.router-badge,
.router-time,
.router-reason,
.router-path-label,
.router-path-value,
.router-extra span,
th,
td,
label {
  font-size: .8125rem;
}
button,
input,
select,
.button {
  font-size: .875rem;
}
.portal-footer,
.footer {
  font-size: .8125rem;
}

/* Navigation */
.site-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 30px;
  padding: 5px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.site-nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
  transition: .18s ease;
}
.site-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.site-nav a.active { color: var(--accent-strong); background: var(--accent-soft); }

/* Shared page shell */
.container {
  width: min(var(--max-width), 100%);
  margin: 0 auto;
}
.page-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px 34px;
  box-shadow: var(--shadow-md);
}
.page-header { margin-bottom: 22px; }
.page-header h1, .header h1 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.035em;
}
.page-subtitle, .header p, .subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: .92rem;
}

/* Shared controls */
.actions, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button, button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  background: #eef1f5;
  color: var(--text);
  font-weight: 700;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.button:hover, button:hover { transform: translateY(-1px); background: #e5e9ef; }
.button-primary, button.primary { background: var(--accent); color: #fff; }
.button-primary:hover, button.primary:hover { background: var(--accent-strong); }
button.danger { color: var(--danger); background: #fff5f4; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Shared feedback */
.status { min-height: 22px; color: var(--muted); font-size: .88rem; }
.status.success { color: var(--success); }
.status.error, .error { color: #991b1b; background: var(--danger-soft); }
.empty {
  padding: 42px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed #cfd6df;
  border-radius: var(--radius-md);
}

/* Home */
.portal-header { display: none; }
.portal-header-inner { display: none; }
.portal-logo { font-family: var(--font-display); }
.portal-kicker {
  color: #9ca3af;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
}
.portal-main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 38px 0 58px;
}
.portal-toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 430px);
  align-items: end;
  gap: 32px;
  margin-bottom: 36px;
}
.portal-intro { margin: 0; }
.portal-eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .14em;
}
.portal-intro h1 {
  margin: 0 0 7px;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -.045em;
}
.portal-intro > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
}
.portal-search-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}
.portal-search-control {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.portal-search-control:focus-within {
  border-color: #93b4ee;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.portal-search-control svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #7c8798;
  stroke-linecap: round;
  stroke-width: 1.8;
}
.portal-search-control input {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-size: .9rem;
}
.portal-search-control input:focus { border: 0; box-shadow: none; }
.portal-search-control input::-webkit-search-cancel-button { cursor: pointer; }
.portal-search-control kbd {
  flex: 0 0 auto;
  min-width: 25px;
  padding: 2px 7px;
  border: 1px solid #d7dde6;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: #778194;
  text-align: center;
  font: 700 .72rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.portal-grid { display: grid; gap: 28px; }
.portal-section {
  margin: 0;
  padding: 22px;
  background: rgba(255, 255, 255, .64);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.portal-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}
.portal-section-title > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.portal-section-title span {
  color: #a1aab8;
  font-size: .68rem;
  font-weight: 800;
}
.portal-section-title h2 {
  margin: 0;
  font-size: .93rem;
  letter-spacing: .085em;
}
.portal-section-title p {
  margin: 0;
  color: #8a94a4;
  font-size: .72rem;
}
.portal-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.portal-card {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .025);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.portal-card:hover {
  transform: translateY(-2px);
  border-color: #c7d4e7;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
}
.portal-card:focus-visible {
  outline: 3px solid #bfdbfe;
  outline-offset: 2px;
}
.portal-card--primary {
  border-color: #dbe7fb;
  background: linear-gradient(145deg, #fff 40%, #f6f9ff);
}
.portal-card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 10px;
  background: #eef3f8;
  color: #334155;
  font-size: .8rem;
  font-weight: 850;
}
.portal-card--primary .portal-card-icon {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.portal-card-copy { min-width: 0; }
.portal-card-name {
  overflow: hidden;
  margin: 0 0 2px;
  font-size: .88rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-card-description {
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-card-arrow {
  color: #a7b0be;
  font-size: .92rem;
  transition: color .16s ease, transform .16s ease;
}
.portal-card:hover .portal-card-arrow {
  color: var(--accent);
  transform: translate(2px, -1px);
}
.portal-card[hidden], .portal-section[hidden] { display: none; }
.portal-empty {
  margin: 0;
  padding: 54px 20px;
  border: 1px dashed #cfd6df;
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}
.portal-footer {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 0 10px;
  border-top: 1px solid var(--line);
  color: #98a1af;
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  letter-spacing: .07em;
}

/* Video */
.video-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }
.summary-card { padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.summary-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.summary-value { margin-top: 4px; font-size: 1.6rem; font-weight: 800; }
.date-group { margin-bottom: 34px; }
.date-divider { display: flex; align-items: center; gap: 14px; margin: 30px 0 18px; font-size: 1.05rem; font-weight: 800; }
.date-divider:before, .date-divider:after { content: ""; height: 1px; background: var(--line); }
.date-divider:before { width: 10px; } .date-divider:after { flex: 1; }
.date-label { white-space: nowrap; }
.timeline { position: relative; }
.timeline:before { content: ""; position: absolute; left: 112px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.event { position: relative; display: grid; grid-template-columns: 100px 1fr; gap: 34px; margin-bottom: 18px; }
.event-time { padding-top: 19px; text-align: right; color: var(--muted); font-size: .8rem; font-weight: 700; }
.event-dot { position: absolute; left: 106px; top: 22px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); z-index: 2; }
.event-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.event-main { padding: 18px 20px; }
.event-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.type { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .75rem; font-weight: 800; }
.type.series { background: #f3e8ff; color: #7e22ce; }.type.movie { background: #ecfdf5; color: #047857; }.type.axi { background: #fff7ed; color: #c2410c; }
.type-extension { margin-left: 5px; font-weight: 800; }.type-extension.subtitle { margin: 0 0 0 5px; font-size: .75rem; }.type-extension.video { color: #0891b2; }.type-extension.video.mp4 { color: #2563eb; }.type-extension.video.avi { color: #6b7280; }.type-extension.video.webm { color: #4f46e5; }.type-extension.subtitle.srt { color: #dc2626; }.type-extension.subtitle.smi { color: #ea580c; }.type-extension.subtitle.ass { color: #db2777; }.type-extension.subtitle.ssa { color: #9333ea; }.type-extension.other { color: #6b7280; }
.event .status, .badge { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; white-space: nowrap; background: var(--success-soft); color: var(--success); }
.title { margin-top: 16px; color: var(--text); font-size: 1.18rem; font-weight: 800; }.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }.meta span { padding: 4px 9px; background: var(--surface-soft); border-radius: 7px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.filename-label, .destination-label { margin-top: 18px; margin-bottom: 6px; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .05em; }.filename { padding: 12px 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); color: #3f4a5a; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; line-height: 1.5; word-break: break-all; }.destination { margin-top: 18px; padding: 13px 15px; background: var(--surface-soft); border-radius: var(--radius-sm); }.destination-root { color: var(--accent); font-weight: 800; }.destination-folder { margin-top: 3px; font-size: .86rem; font-weight: 700; word-break: break-word; }

/* Subtitle */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table { width: 100%; min-width: 820px; border-collapse: collapse; background: var(--surface); }
thead { background: var(--surface-soft); } th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .9rem; } th { color: #465164; font-weight: 750; white-space: nowrap; } th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--accent); } th.sortable:after { content: " ↕"; color: #a3acb9; font-size: .78rem; } th.sortable.sorted-asc:after { content: " ↑"; color: var(--accent); } th.sortable.sorted-desc:after { content: " ↓"; color: var(--accent); }
th.no-column, td.no-column { width: 56px; text-align: center; color: var(--muted); font-weight: 700; } td small { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; }.title-link { color: var(--text); font-weight: 700; }.title-link:hover { color: var(--accent); text-decoration: underline; }.status-wait { background: var(--warning-soft); color: var(--warning); }

/* AutoLive */
.autolive-shell .stream-list { display: grid; gap: 12px; }
.stream-card, .editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; box-shadow: var(--shadow-sm); }
.stream-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }.stream-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #c9d6ea; }.stream-card.disabled { opacity: .6; }.stream-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }.stream-name { margin-bottom: 4px; font-size: 1.05rem; font-weight: 800; }.stream-meta { color: var(--muted); font-size: .84rem; }.stream-url { margin: 12px 0; overflow-wrap: anywhere; color: #4b5563; font-size: .84rem; }.days { display: inline-flex; gap: 5px; flex-wrap: wrap; }.day { padding: 4px 8px; border-radius: 7px; background: #eef2f6; color: var(--muted); font-size: .72rem; font-weight: 700; }.day.active { background: var(--text); color: #fff; }.badge.off { background: #eef1f4; color: var(--muted); }
.editor { margin-top: 20px; }.editor h2 { margin: 0 0 18px; font-size: 1.25rem; }.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }.field.full { grid-column: 1 / -1; }label { display: block; margin-bottom: 6px; font-size: .78rem; font-weight: 700; }input, select { width: 100%; padding: 10px 11px; border: 1px solid #d4dae2; border-radius: var(--radius-sm); background: #fff; color: var(--text); outline: none; }input:focus, select:focus { border-color: #93b4ee; box-shadow: 0 0 0 3px var(--accent-soft); }.day-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }.day-checkboxes label { display: flex; align-items: center; gap: 5px; margin: 0; padding: 8px 10px; border: 1px solid #d8dee6; border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; }.day-checkboxes input, .toggle input { width: auto; }.toggle { display: flex; align-items: center; gap: 8px; margin-top: 26px; }
.list-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 12px; }.list-toolbar label { margin: 0; }.list-toolbar select { width: auto; min-width: 170px; }

/* Responsive */
@media (max-width: 1100px) { .portal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .video-summary { grid-template-columns: repeat(2, 1fr); } .portal-toolbar { grid-template-columns: 1fr; gap: 20px; } }
@media (max-width: 700px) {
  body { padding: 20px 12px 40px; }
  .page-shell { padding: 22px 16px 28px; }
  .app-header { width: calc(100% + 24px); margin-left: -12px; margin-right: -12px; margin-top: -20px; }
  .app-header-inner { width: calc(100% - 24px); min-height: 60px; grid-template-columns: 1fr auto; gap: 12px; }
  .app-nav { grid-column: 1 / -1; order: 3; justify-content: flex-start; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav a { padding: 8px 10px; font-size: .8125rem; }
  .page-shell, .portal-main { padding: 28px 0 42px; }
  .portal-toolbar { margin-bottom: 24px; }.portal-grid { gap: 18px; }.portal-section { padding: 17px; }
  .portal-cards { grid-template-columns: 1fr; }.portal-section-title p { display: none; }.portal-footer { padding-left: 2px; padding-right: 2px; }
  .timeline:before { display: none; }.event { display: block; }.event-time { padding: 0 0 6px 2px; text-align: left; }.event-dot { display: none; }
  .grid { grid-template-columns: 1fr; }.field.full { grid-column: auto; }.stream-head { flex-direction: column; }
  .top-bar { justify-content: space-between; }
}
@media (max-width: 480px) { .video-summary { grid-template-columns: 1fr 1fr; }.event-main { padding: 16px; }.date-divider { font-size: .98rem; }.portal-kicker { display: none; }.portal-search-control kbd { display: none; }.portal-card { min-height: 72px; }.portal-footer span:last-child { display: none; } }

/* Download Router cards use one shared outline; event state stays in badges. */
.router-card.is-quarantine,
.router-card.is-delete,
.router-card.is-failed,
html[data-theme="dark"] .router-card.is-quarantine,
html[data-theme="dark"] .router-card.is-delete,
html[data-theme="dark"] .router-card.is-failed {
  border-color: var(--line);
}


/* Notes */
.notes-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.notes-page-header > div { min-width: 0; }
.notes-editor {
  margin-bottom: 24px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.notes-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.notes-editor-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
}
.notes-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
}
.notes-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(150px, .7fr));
  gap: 14px;
}
.notes-title-field { grid-column: span 1; }
.notes-tags-field { grid-column: span 2; }
.notes-pin {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 8px;
  min-height: 42px;
  margin: 0;
}
.notes-pin input { width: auto; min-height: auto; }
.notes-environment-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.notes-environment-head,
.notes-environment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notes-environment-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.notes-environment-head strong { color: var(--text); font-size: .875rem; }
.notes-environment-head span { color: var(--subtle); font-size: .75rem; }
.notes-environment-field button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .8125rem;
}
.notes-environment-field button:hover { border-color: var(--line-strong); color: var(--accent-strong); }
.notes-environment-field button:disabled { opacity: .55; cursor: wait; }
.notes-location-current,
.notes-weather-current {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: .8125rem;
}
.notes-location-pin { flex: 0 0 auto; color: var(--accent-strong); }
#note-location-label,
#note-weather-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-location-preview {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.notes-location-preview[hidden] { display: none; }
.notes-location-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  font-size: .8125rem;
}
.notes-location-preview-head strong { color: var(--text); }
.notes-location-preview-head a { color: var(--accent-strong); text-decoration: none; }
.notes-location-preview-head a:hover { text-decoration: underline; }
.notes-map-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(90deg, transparent 49.5%, var(--line) 49.5%, var(--line) 50.5%, transparent 50.5%),
    linear-gradient(transparent 49.5%, var(--line) 49.5%, var(--line) 50.5%, transparent 50.5%),
    var(--surface);
  background-size: 44px 44px;
  cursor: pointer;
}
.notes-map-frame:hover { background-color: var(--accent-soft); }
.notes-map-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -70%);
  color: var(--accent-strong);
  font-size: 1.35rem;
  text-align: center;
}
.notes-map-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
  transform: translateX(-50%);
  opacity: .35;
}
.notes-map-label {
  position: relative;
  z-index: 3;
  max-width: min(88%, 620px);
  margin-top: 64px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
}
.notes-badge.location {
  background: var(--surface-soft);
  color: var(--subtle);
}
.notes-content-field { grid-column: 1 / -1; }
.notes-content-field textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 400 1rem/1.75 var(--font-body);
  outline: none;
}
.notes-content-field textarea:focus {
  border-color: #93b4ee;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.notes-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.notes-delete {
  margin-left: auto;
  color: var(--danger);
  background: var(--danger-soft);
}
.notes-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(130px, auto)) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.notes-toolbar label { margin: 0; }
.notes-toolbar label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 700;
}
.notes-view-switch {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--control);
  border-radius: 10px;
}
.notes-view-switch button {
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.notes-view-switch button.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
}
.notes-list {
  display: grid;
  gap: 12px;
}
.notes-list.view-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.note-card {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.notes-list.view-cards .note-card {
  display: flex;
  flex-direction: column;
}
.notes-list.view-cards .note-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.notes-list.view-cards .note-card-head time {
  grid-row: 2;
}
.notes-list.view-cards .note-card-foot {
  margin-top: auto;
}
.note-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.note-card:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}
.note-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.note-card-head time {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: .75rem;
}
.note-badges, .note-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.notes-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--control);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
}
.notes-badge.pinned { background: var(--warning-soft); color: var(--warning); }
.notes-badge.status-complete { background: var(--success-soft); color: var(--success); }
.notes-badge.status-archive { opacity: .72; }
.notes-badge.tag {
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--subtle);
  font-weight: 600;
}
.note-card h2 {
  margin: 15px 0 8px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.45;
}
.note-card-image {
  margin: 0 0 14px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-soft);
}
.note-card-image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}
.notes-list.view-list .note-card-image {
  width: 96px;
  height: 64px;
  margin: 0;
}
.notes-list.view-list .note-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-card-content {
  overflow: hidden;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notes-list.view-cards .note-card-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 12.8em;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1.6em), transparent 100%);
}
.notes-list.view-cards .note-card.has-image .note-card-content {
  max-height: 6.4em;
}
.notes-list.view-list .note-card {
  display: grid;
  grid-template-columns: minmax(210px, .9fr) minmax(280px, 1.4fr) auto;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
}
.notes-list.view-list .note-card-head { grid-column: 3; grid-row: 1; }
.notes-list.view-list .note-card h2 { grid-column: 1; grid-row: 1; margin: 0; }
.notes-list.view-list .note-card-content {
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  margin: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
}
.notes-list.view-list .note-card-foot { display: none; }

@media (max-width: 1050px) {
  .notes-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .notes-search { grid-column: 1 / -1; }
  .notes-view-switch { justify-self: start; }
  .notes-list.view-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-title-field, .notes-tags-field { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .notes-page-header { align-items: flex-start; flex-direction: column; }
  .notes-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-search, .notes-view-switch { grid-column: 1 / -1; }
  .notes-view-switch { justify-self: stretch; }
  .notes-view-switch button { flex: 1; }
  .notes-list.view-cards { grid-template-columns: 1fr; }
  .notes-list.view-list .note-card { display: block; }
  .notes-list.view-list .note-card-head { margin-bottom: 12px; }
  .notes-list.view-list .note-card h2 { margin-bottom: 8px; }
  .notes-form-grid { grid-template-columns: 1fr; }
  .notes-title-field, .notes-tags-field, .notes-content-field { grid-column: auto; }
  .notes-editor { padding: 17px; }
  .notes-content-field textarea { min-height: 260px; }
}

/* Notes workspace: folders + status + responsive sidebar */
.notes-workspace {
  position: relative;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  width: 100%;
}
.notes-main {
  width: 100%;
  min-width: 0;
}
.notes-main-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 16px;
}
.notes-main-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.0625rem;
}
.notes-main-head p {
  margin: 2px 0 0;
  color: var(--subtle);
  font-size: .8125rem;
}
.notes-sidebar {
  flex: 0 0 250px;
  width: 250px;
  position: sticky;
  top: 20px;
  overflow-y: auto;
  max-height: calc(100dvh - 40px);
  padding: 14px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.notes-sidebar-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 6px 10px;
  color: var(--text);
  font-weight: 800;
}
.notes-sidebar-close {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1.35rem;
}
.notes-sidebar-section + .notes-sidebar-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.notes-sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 8px 6px;
}
.notes-sidebar-title h2 {
  margin: 0;
  color: var(--subtle);
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.notes-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--subtle);
}
.notes-icon-button:hover {
  background: var(--control);
  color: var(--accent-strong);
}
.notes-filter-row,
.notes-folder-row {
  width: 100%;
  border-radius: 9px;
}
.notes-sidebar-section > .notes-filter-row + .notes-filter-row,
.notes-folder-list .notes-folder-row + .notes-folder-row {
  margin-top: 5px;
}
.notes-filter-row,
.notes-folder-select {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 39px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.notes-filter-row:hover,
.notes-folder-row:hover { background: var(--control); }
.notes-filter-row.active,
.notes-folder-row.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.notes-filter-icon {
  color: var(--subtle);
  font-size: .875rem;
  text-align: center;
}
.notes-filter-label {
  overflow: hidden;
  font-size: .875rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-filter-count {
  min-width: 22px;
  color: var(--subtle);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.notes-sidebar-rule {
  height: 1px;
  margin: 5px 9px 7px 38px;
  background: var(--line);
}
.notes-folder-list {
  overflow-y: auto;
  max-height: min(40dvh, max(120px, calc(100dvh - 370px)));
  scrollbar-width: thin;
}
.notes-folder-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
}
.notes-folder-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-height: 30px;
  margin-left: 3px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--subtle);
  font-size: .95rem;
  line-height: 1;
}
.notes-folder-icon-button:hover,
.notes-folder-icon-button:focus-visible {
  background: var(--surface);
  color: var(--accent-strong);
}
.notes-folder-select {
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  padding-left: 4px;
}
.notes-folder-select .notes-filter-label { color: inherit; }
.notes-folder-select { color: inherit; }
.notes-folder-context-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  width: 140px;
  padding: 5px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}
.notes-folder-action {
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: .8125rem;
  text-align: left;
}
.notes-folder-action:hover,
.notes-folder-action:focus-visible { background: var(--control); color: var(--accent-strong); }
.notes-folder-action:disabled { opacity: .28; cursor: default; }
.notes-folder-icon-picker {
  grid-template-columns: repeat(6, 34px);
  gap: 4px;
  width: auto;
  max-width: calc(100vw - 16px);
  padding: 7px;
}
.notes-folder-icon-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
}
.notes-folder-icon-choice:hover,
.notes-folder-icon-choice:focus-visible { background: var(--control); color: var(--accent-strong); }
.notes-folder-icon-choice.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.notes-add-folder {
  width: 100%;
  margin-top: 7px;
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--subtle);
  text-align: left;
}
.notes-sidebar-toggle {
  display: none;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 11px;
  background: var(--surface);
}
.notes-workspace.sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.notes-workspace.sidebar-collapsed .notes-sidebar { display: none; }
.notes-workspace.sidebar-collapsed .notes-sidebar-toggle { display: inline-flex; }
.notes-toolbar {
  grid-template-columns: minmax(220px, 1fr) minmax(135px, auto) auto auto;
}
.notes-toolbar .notes-new-note {
  align-self: end;
  white-space: nowrap;
}
.notes-badge.folder {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.notes-badge.status-draft {
  background: var(--control);
  color: var(--muted);
}
.notes-drawer-backdrop { display: none; }

@media (max-width: 1100px) and (min-width: 901px) {
  .notes-workspace { grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }
  .notes-sidebar { flex-basis: 240px; width: 240px; }
  .notes-sidebar-toggle-label { display: none; }
  .notes-toolbar { grid-template-columns: minmax(190px, 1fr) minmax(130px, auto) auto; }
  .notes-toolbar .notes-new-note { grid-column: auto; }
}
@media (max-width: 900px) {
  .notes-page-header { margin-bottom: 20px; }
  .notes-workspace { display: block; }
  .notes-main { width: 100%; }
  .notes-main-head { margin-bottom: 12px; }
  .notes-sidebar-toggle { display: inline-flex; }
  .notes-sidebar {
    width: min(84vw, 310px);
    flex-basis: auto;
    position: fixed;
    z-index: 120;
    top: 0;
    bottom: 0;
    left: 0;
    max-height: none;
    padding: 14px 12px 24px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0 18px 18px 0;
    box-shadow: var(--shadow-md);
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .notes-workspace.drawer-open .notes-sidebar { visibility: visible; pointer-events: auto; transform: translateX(0); }
  .notes-sidebar-head { display: flex; }
  .notes-workspace.drawer-open .notes-drawer-backdrop:not([hidden]) {
    position: fixed;
    z-index: 110;
    inset: 0;
    display: block;
    background: rgba(15, 23, 42, .48);
  }
  body.notes-drawer-lock { overflow: hidden; }
  .notes-folder-list { max-height: 46vh; }
  .notes-folder-menu summary { display: flex; }
  .notes-toolbar { grid-template-columns: minmax(0, 1fr) minmax(120px, .45fr); }
  .notes-search { grid-column: 1 / -1; }
  .notes-view-switch { grid-column: 1; justify-self: stretch; }
  .notes-toolbar .notes-new-note { grid-column: 2; width: 100%; }
}
@media (max-width: 520px) {
  .notes-toolbar { grid-template-columns: 1fr; }
  .notes-search,
  .notes-view-switch,
  .notes-toolbar .notes-new-note { grid-column: 1; }
  .notes-toolbar .notes-new-note { min-height: 40px; }
  .notes-main-head p { max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Notes sizing: reflow inside the Main column, never depend on page width. */
.notes-shell [hidden] { display: none !important; }
.notes-main-head { flex-wrap: wrap; }
.notes-main-head > div { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.notes-main-head h2 { word-break: keep-all; overflow-wrap: anywhere; }
.notes-main-head p { max-width: none; white-space: normal; }
.notes-main-head .notes-new-note { margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
.notes-shell .notes-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; }
.notes-toolbar .notes-search { flex: 1 1 220px; min-width: 0; }
.notes-toolbar label:not(.notes-search) { flex: 0 1 160px; min-width: 0; }
.notes-shell .notes-view-switch { flex: 0 0 auto; }
.notes-view-switch button { white-space: nowrap; }
.notes-shell input, .notes-shell select, .notes-shell textarea { min-width: 0; max-width: 100%; }
.notes-shell .notes-list.view-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.notes-shell .notes-list.view-list .note-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.notes-shell .notes-list.view-list .note-card > * { grid-column: 1; grid-row: auto; }
.notes-shell .notes-list.view-list .note-card-head { margin: 0; }
.note-card-head { flex-wrap: wrap; }
.note-card h2, .notes-badge { overflow-wrap: anywhere; max-width: 100%; }
.note-badges, .note-card-foot { min-width: 0; }
.notes-badge { font-size: .8125rem; }
.notes-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.notes-title-field, .notes-tags-field { grid-column: 1 / -1; }
.notes-form-grid > * { min-width: 0; }
.notes-form-actions { flex-wrap: wrap; }
body.notes-page { min-width: 0; }
.notes-page .app-header-inner { min-width: 0; }
@media (max-width: 520px) {
  .notes-shell .notes-form-grid { grid-template-columns: minmax(0, 1fr); }
  .notes-shell .notes-form-grid > * { grid-column: 1; }
  .notes-toolbar .notes-search { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .notes-sidebar { transition: none; }
}

.notes-home-link { color: inherit; text-decoration: none; }
.notes-home-link:hover { color: var(--accent-strong); }

.notes-attachments-field {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.notes-attachments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.notes-attachments-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.notes-attachments-head strong { font-size: .875rem; }
.notes-attachments-head span { color: var(--subtle); font-size: .75rem; }
.notes-attachment-add {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .8125rem;
  cursor: pointer;
}
.notes-attachment-add:hover { border-color: var(--line-strong); color: var(--accent-strong); }
.notes-attachment-add input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.notes-attachment-list { display: grid; gap: 6px; }
.notes-attachment-empty {
  padding: 8px 2px 2px;
  color: var(--subtle);
  font-size: .8125rem;
}
.notes-attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.notes-attachment-row.pending { border-style: dashed; }
.notes-attachment-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.notes-attachment-info a,
.notes-attachment-info strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: .8125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-attachment-info a { text-decoration: none; }
.notes-attachment-info a:hover { color: var(--accent-strong); text-decoration: underline; }
.notes-attachment-info span {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: .75rem;
}
.notes-attachment-remove {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: .75rem;
}
.notes-badge.attachment { background: var(--surface-soft); color: var(--subtle); }
@media (max-width: 520px) {
  .notes-attachments-head,
  .notes-attachment-info { align-items: flex-start; }
  .notes-attachment-info { flex-direction: column; gap: 2px; }
}

.notes-viewer {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.notes-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.notes-viewer-head > div:first-child { min-width: 0; }
.notes-viewer-head h2 {
  margin: 10px 0 5px;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  overflow-wrap: anywhere;
}
.notes-viewer-dates { color: var(--subtle); font-size: .75rem; }
.notes-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.notes-viewer-content {
  min-height: 90px;
  padding: 20px 2px;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notes-viewer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.notes-viewer-location {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .8125rem;
}
.notes-viewer-location[hidden] { display: none; }
.notes-viewer-weather {
  display: flex;
  align-items: center;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .8125rem;
}
.notes-viewer-weather[hidden] { display: none; }
.notes-viewer-location span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-viewer-location a {
  flex: 0 0 auto;
  color: var(--accent-strong);
  text-decoration: none;
}
.notes-viewer-location a:hover { text-decoration: underline; }
.notes-viewer-media {
  display: grid;
  gap: 16px;
  margin: 18px 0 20px;
}
.notes-viewer-media[hidden] { display: none; }
.notes-viewer-image {
  margin: 0;
}
.notes-viewer-image-button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: zoom-in;
}
.notes-viewer-image img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 9px;
}

.notes-viewer-attachments {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.notes-viewer-attachments[hidden] { display: none; }
.notes-viewer-attachments h3 {
  margin: 0 0 8px;
  font-size: .875rem;
}
@media (max-width: 520px) {
  .notes-viewer { padding: 15px; }
  .notes-viewer-head { gap: 10px; }
  .notes-viewer-location { align-items: flex-start; flex-direction: column; }
  .notes-viewer-location span { white-space: normal; }
  .notes-environment-head,
  .notes-environment-row { align-items: stretch; flex-direction: column; }
  .notes-environment-field button { width: 100%; }
  #note-location-label,
  #note-weather-label { white-space: normal; }
}

.notes-viewer-attachments .notes-attachment-list:has(.notes-image-attachment) {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.notes-image-attachment {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.notes-image-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--surface-soft);
  cursor: zoom-in;
}
.notes-image-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.notes-image-attachment figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 8px 8px;
}
.notes-image-attachment figcaption span {
  overflow: hidden;
  color: var(--text);
  font-size: .75rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-image-attachment figcaption small { color: var(--subtle); font-size: .6875rem; }
.notes-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 20px 20px;
  background: rgba(0, 0, 0, .84);
}
.notes-image-lightbox[hidden] { display: none; }
.notes-image-lightbox img {
  display: block;
  max-width: 96vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
}
.notes-image-lightbox-close {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 1.5rem;
}
body.notes-lightbox-lock { overflow: hidden; }
@media (max-width: 520px) {
  .notes-viewer-attachments .notes-attachment-list:has(.notes-image-attachment) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Notes attachment UX v1.9.1 */
.notes-attachment-drop-hint {
  margin: 0 0 8px;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--subtle);
  font-size: .75rem;
  text-align: center;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.notes-attachments-field.drag-over {
  border-color: var(--accent-strong);
  background: var(--surface);
}
.notes-attachments-field.drag-over .notes-attachment-drop-hint {
  border-color: var(--accent-strong);
  background: var(--surface-soft);
  color: var(--accent-strong);
}
.notes-attachment-mini-thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  cursor: zoom-in;
}
.notes-attachment-mini-thumb.pending-preview { cursor: default; }
.notes-attachment-mini-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 520px) {
  .notes-attachment-drop-hint { display: none; }
  .notes-attachment-row.image-file { align-items: flex-start; }
  .notes-attachment-mini-thumb {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }
}

/* Project documentation viewer */
.docs-shell { max-width: var(--max-width); }
.docs-page-header { margin-bottom: 22px; }
.docs-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.docs-tabs a {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}
.docs-tabs a:hover { color: var(--text); border-color: var(--line-strong); }
.docs-tabs a.active { color: var(--accent-strong); background: var(--accent-soft); border-color: transparent; }
.docs-tabs .docs-back { margin-left: auto; }
.docs-markdown {
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.docs-markdown > :first-child { margin-top: 0; }
.docs-markdown > :last-child { margin-bottom: 0; }
.docs-markdown h1, .docs-markdown h2, .docs-markdown h3, .docs-markdown h4 {
  margin: 1.7em 0 .65em;
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.3;
}
.docs-markdown h1 { font-size: clamp(1.7rem, 4vw, 2.35rem); }
.docs-markdown h2 { padding-bottom: .35em; border-bottom: 1px solid var(--line); font-size: 1.45rem; }
.docs-markdown h3 { font-size: 1.16rem; }
.docs-markdown p, .docs-markdown ul, .docs-markdown ol, .docs-markdown blockquote, .docs-markdown pre, .docs-markdown table { margin: 0 0 1.1em; }
.docs-markdown ul, .docs-markdown ol { padding-left: 1.5em; }
.docs-markdown a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
.docs-markdown code { padding: .16em .38em; border-radius: 5px; background: var(--surface-soft); font-size: .9em; }
.docs-markdown pre { overflow-x: auto; padding: 16px; border-radius: 9px; background: var(--surface-soft); }
.docs-markdown pre code { padding: 0; background: transparent; }
.docs-markdown blockquote { padding-left: 15px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.docs-markdown table { width: 100%; border-collapse: collapse; }
.docs-markdown th, .docs-markdown td { padding: 9px 11px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.docs-markdown img { max-width: 100%; height: auto; border-radius: 8px; }
@media (max-width: 700px) {
  .docs-tabs { align-items: stretch; }
  .docs-tabs .docs-back { width: 100%; margin-left: 0; text-align: center; }
  .docs-markdown { padding: 20px 16px; border-radius: var(--radius-md); }
}

/* Shared project documentation entry */
.page-doc-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 650;
  line-height: 1.2;
}
.page-doc-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

