:root {
  --bg: #060e20;
  --bg-alt: #091328;
  --bg-elevated: #0f1930;
  --panel: rgba(15, 25, 48, 0.9);
  --panel-strong: rgba(20, 31, 56, 0.96);
  --panel-soft: rgba(25, 37, 64, 0.74);
  --line: rgba(64, 72, 93, 0.52);
  --line-strong: rgba(109, 117, 140, 0.56);
  --text: #dee5ff;
  --muted: #a3aac4;
  --accent: #85adff;
  --accent-strong: #6e9fff;
  --accent-soft: rgba(110, 159, 255, 0.2);
  --accent-glow: rgba(133, 173, 255, 0.24);
  --ok: #9bffce;
  --ok-soft: rgba(0, 90, 60, 0.42);
  --warn: #ffc46b;
  --warn-soft: rgba(130, 86, 24, 0.46);
  --danger: #ff716c;
  --danger-soft: rgba(159, 5, 25, 0.52);
  --shadow-lg: 0 16px 38px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 10px 22px rgba(0, 0, 0, 0.24);
  --r-sm: 1px;
  --r-md: 2px;
  --r-lg: 2px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(circle at top right, rgba(64, 102, 180, 0.16), transparent 30%),
    linear-gradient(180deg, #060e20 0%, #060e20 100%);
  color: var(--text);
  font-family: "Space Grotesk", "Pretendard", "Noto Sans KR", sans-serif;
  line-height: 1.45;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 30%);
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

/* Tailwind radius hard override for square look */
.rounded,
.rounded-sm,
.rounded-md,
.rounded-lg,
.rounded-xl,
.rounded-2xl,
.rounded-3xl {
  border-radius: var(--r-lg) !important;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

#app {
  height: 100%;
  min-height: 100%;
}

h1,
h2,
h3 {
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: min(480px, 100%);
  background:
    linear-gradient(180deg, rgba(20, 37, 67, 0.94), rgba(10, 19, 37, 0.96));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 28px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-lg);
}

.shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #060e20 0%, #050d1d 100%);
}

.sidebar {
  min-height: calc(100vh - 28px);
  position: sticky;
  top: 14px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-alt);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 20%);
}

.sidebar-panel,
.sidebar-meta {
  position: relative;
  z-index: 1;
}

.sidebar-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #001a42;
  background: var(--accent-strong);
  box-shadow: none;
}

.brand-copy {
  display: grid;
  gap: 3px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.sidebar-user {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 6px;
}

.sidebar-user-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #7f96bb;
}

.sidebar-user-value {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sidebar-user-meta {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 14px;
  align-content: start;
}

.nav-section {
  display: grid;
  gap: 8px;
}

.nav-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: color-mix(in srgb, var(--muted) 60%, transparent);
  font-weight: 700;
  padding: 0 4px;
}

.nav-items {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.015);
  color: var(--text);
  border-radius: var(--r-md);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.nav-copy > span {
  font-size: 14px;
  font-weight: 600;
}

.nav-icon {
  color: color-mix(in srgb, var(--muted) 82%, white 18%);
  flex: 0 0 auto;
}

.nav-copy {
  display: grid;
  gap: 1px;
}

.nav-copy span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
}

.nav button small {
  color: color-mix(in srgb, var(--muted) 62%, transparent);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav button:hover {
  transform: none;
  border-color: rgba(133, 173, 255, 0.2);
  background: rgba(25, 37, 64, 0.8);
}

.nav button.active {
  background: #192540;
  border-color: rgba(133, 173, 255, 0.36);
  box-shadow: 0 0 0 1px rgba(133, 173, 255, 0.16);
}

.nav button.active .nav-icon {
  color: var(--accent);
}

.sidebar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-footer {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.sidebar-profile {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(110, 168, 255, 0.94), rgba(77, 141, 250, 0.86));
  color: #0c1b33;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.sidebar-profile-name {
  font-size: 13px;
  font-weight: 700;
}

.sidebar-profile-tier {
  color: var(--muted);
  font-size: 11px;
}

.main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 38px;
  gap: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(57, 91, 162, 0.12), transparent 35%),
    linear-gradient(180deg, rgba(6, 14, 32, 0.96), rgba(3, 9, 20, 1));
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(6, 14, 32, 0.88);
  backdrop-filter: blur(16px);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.topbar-copy {
  display: grid;
  gap: 6px;
}

.topbar-zone-left,
.topbar-zone-center,
.topbar-zone-right {
  min-width: 0;
}

.topbar-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #7a90b6;
}

.topbar-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--accent);
}

.topbar-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-tabs button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}

.topbar-tabs button.active,
.topbar-tabs button:hover {
  color: #e7f0ff;
  border-bottom-color: rgba(126, 174, 255, 0.84);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-buttons {
  gap: 10px;
}

.topbar-search {
  border-radius: 999px;
  min-height: 36px;
  font-size: 13px;
  padding-left: 12px;
  padding-right: 12px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.app-sidebar {
  position: relative;
  width: 100% !important;
  height: 100%;
  min-height: 0;
  padding: 18px 14px 12px !important;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 0% 0%, rgba(96, 131, 206, 0.14), transparent 38%),
    linear-gradient(180deg, #091328 0%, #081226 100%);
}

.app-sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 20%);
}

.app-sidebar > * {
  position: relative;
  z-index: 1;
}

.app-sidebar-nav {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  margin-right: -2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 117, 140, 0.55) transparent;
}

.app-sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.app-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(109, 117, 140, 0.5);
}

.app-nav-btn {
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  line-height: 1.2;
  min-height: 40px;
  letter-spacing: 0;
}

.app-nav-btn:hover {
  border-color: rgba(133, 173, 255, 0.2);
}

.app-nav-btn[aria-current="page"] {
  border-color: rgba(133, 173, 255, 0.34);
}

.app-nav-icon {
  color: color-mix(in srgb, var(--muted) 86%, white 14%);
}

.app-nav-label {
  font-size: 13px !important;
  font-weight: 600;
  letter-spacing: 0.05em !important;
  line-height: 1.1;
}

.app-brand-title {
  letter-spacing: -0.02em;
}

.app-brand-caption {
  letter-spacing: 0.16em !important;
}

.app-nav-group-label {
  letter-spacing: 0.14em !important;
}

.app-sidebar-bottom {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.app-account-card {
  min-height: 58px;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
}

.app-account-avatar {
  letter-spacing: 0.02em;
  font-size: 13px;
}

.app-account-name {
  line-height: 1.2;
}

.app-account-meta {
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.app-topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 14, 32, 0.72);
  backdrop-filter: blur(14px);
}

.app-topbar-left,
.app-topbar-right {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-topbar-left {
  flex: 1 1 auto;
}

.app-topbar-right {
  flex: 0 0 auto;
}

.app-topbar-brand {
  color: var(--accent);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.app-topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-top-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 7px 6px;
  letter-spacing: 0.03em;
}

.app-top-tab:hover,
.app-top-tab.active {
  color: #e7f0ff;
  border-bottom-color: rgba(126, 174, 255, 0.84);
}

.app-topbar-search {
  flex: 1 1 auto;
}

.app-topbar-search-input {
  width: 260px !important;
  min-width: 200px;
  max-width: 320px;
  font-size: 12px;
  height: 32px;
  letter-spacing: 0.01em;
}

.app-topbar-icons {
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-md);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.app-icon-btn:hover {
  border-color: rgba(133, 173, 255, 0.24);
  color: #d9e6ff;
  background: rgba(133, 173, 255, 0.08);
}

.app-signout-btn {
  min-height: 30px;
  white-space: nowrap;
  padding: 0 12px !important;
  font-size: 12px !important;
}

.app-footer {
  height: 38px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  background: rgba(6, 14, 32, 0.76);
  color: color-mix(in srgb, var(--muted) 90%, white 10%);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-footer-pill {
  border: 1px solid rgba(133, 173, 255, 0.32);
  background: rgba(133, 173, 255, 0.11);
  color: #b8d2ff;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.content {
  min-width: 0;
  min-height: 0;
  padding: 10px 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  display: block;
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 117, 140, 0.6) transparent;
}

.content::-webkit-scrollbar {
  width: 10px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: rgba(109, 117, 140, 0.56);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.content::-webkit-scrollbar-thumb:hover {
  background: rgba(133, 173, 255, 0.7);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.detail-page {
  display: grid;
  gap: 10px;
}

.page-header {
  display: grid;
  gap: 5px;
}

.page-banner {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(17, 30, 57, 0.96), rgba(12, 23, 44, 0.96));
  box-shadow: var(--shadow-md);
}

.page-header h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  gap: 10px;
}

.cards.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stack {
  display: grid;
  gap: 10px;
}

.card {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  display: grid;
  gap: 9px;
  box-shadow: var(--shadow-md);
}

.card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: color-mix(in srgb, var(--muted) 94%, white 6%);
}

.hero-card {
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 18px 22px;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(91, 135, 239, 0.22), transparent 28%),
    linear-gradient(135deg, rgba(19, 35, 65, 0.98), rgba(8, 18, 35, 0.96));
}

.welcome-hero {
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: center;
  background:
    radial-gradient(circle at 90% 50%, rgba(98, 162, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(20, 31, 56, 0.96), rgba(15, 25, 48, 0.98));
}

.welcome-hero-copy h2 {
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -0.03em;
  line-height: 1.06;
}

.welcome-hero-copy p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  max-width: 58ch;
}

.system-health {
  border: 1px solid rgba(133, 173, 255, 0.3);
  background: rgba(20, 31, 56, 0.8);
  border-radius: var(--r-lg);
  padding: 14px;
  text-align: center;
}

.system-health-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.system-health-value {
  margin-top: 4px;
  color: #9bffce;
  font-size: 28px;
  font-weight: 700;
}

.square-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.square-left {
  display: grid;
  gap: 16px;
}

.card-kicker {
  color: var(--muted);
  letter-spacing: 0.14em;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(126, 174, 255, 0.95), rgba(77, 141, 250, 0.88));
}

.master-key-card {
  background:
    linear-gradient(180deg, rgba(7, 14, 27, 0.96), rgba(3, 8, 18, 0.96));
}

.master-key-track {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.master-key-dots {
  letter-spacing: 0.14em;
  color: #8ca6ce;
  font-size: 14px;
}

.square-feed-card {
  min-height: 360px;
}

.feed-list {
  display: grid;
  gap: 10px;
}

.feed-item {
  border: 1px solid rgba(145, 172, 214, 0.12);
  border-radius: var(--r-sm);
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.feed-item-title {
  font-weight: 600;
}

.feed-item-meta,
.feed-date {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.square-entry-cards .entry-card {
  min-height: 180px;
  align-content: space-between;
}

.hero-copy {
  display: grid;
  gap: 10px;
  align-content: start;
}

.hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #83a2d7;
}

.hero-title {
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.hero-subtitle {
  max-width: 62ch;
  color: var(--muted);
  font-size: 15px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.hero-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-card {
  align-content: start;
}

.surface-list {
  display: grid;
  gap: 10px;
}

.surface-list-item {
  padding: 12px 14px;
  border: 1px solid rgba(145, 172, 214, 0.1);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 4px;
}

.surface-list-meta {
  color: var(--muted);
  font-size: 12px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 112px;
  align-content: space-between;
}

.stat .label {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.stat .value {
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat .note {
  color: var(--muted);
  font-size: 11px;
}

.tone-ok {
  border-color: rgba(121, 230, 177, 0.22);
  background:
    linear-gradient(180deg, rgba(20, 41, 38, 0.92), rgba(9, 22, 22, 0.94));
}

.tone-warn {
  border-color: rgba(255, 196, 107, 0.24);
  background:
    linear-gradient(180deg, rgba(49, 34, 16, 0.92), rgba(25, 17, 8, 0.94));
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.btn {
  border: 1px solid rgba(145, 172, 214, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.btn:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(145, 172, 214, 0.26);
}

.btn.btn-primary {
  background: var(--accent-strong);
  color: #001a42;
  border-color: rgba(120, 174, 255, 0.45);
  box-shadow: none;
}

.btn.btn-primary:hover {
  background: var(--accent);
}

.btn.btn-danger {
  color: #ffd6d9;
  border-color: rgba(255, 143, 150, 0.28);
  background: rgba(94, 30, 41, 0.32);
}

.btn.btn-danger:hover {
  background: rgba(116, 38, 52, 0.42);
}

.btn.btn-warn {
  color: #ffe4bc;
  border-color: rgba(255, 196, 107, 0.26);
  background: rgba(96, 66, 28, 0.3);
}

.btn.btn-warn:hover {
  background: rgba(118, 81, 34, 0.42);
}

.btn:focus-visible,
.nav button:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid rgba(110, 168, 255, 0.66);
  outline-offset: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(145, 172, 214, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #dbe9ff;
  border-radius: var(--r-sm);
  font-size: 11px;
  padding: 5px 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  width: fit-content;
}

.chip.chip-ok {
  border-color: rgba(121, 230, 177, 0.24);
  color: #b5ffd5;
  background: var(--ok-soft);
}

.chip.chip-warn {
  border-color: rgba(255, 196, 107, 0.24);
  color: #ffdca4;
  background: var(--warn-soft);
}

.alert {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: var(--shadow-md);
}

.alert.ok {
  border-color: rgba(121, 230, 177, 0.22);
  color: #c6ffe2;
  background: var(--ok-soft);
}

.alert.warn {
  border-color: rgba(255, 196, 107, 0.24);
  color: #ffe0ae;
  background: var(--warn-soft);
}

.compact-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  color: #dce7fa;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.board-filter {
  width: auto;
  min-width: 120px;
}

.board-list {
  gap: 10px;
}

.board-item {
  gap: 7px;
}

.board-item h3 {
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 15px;
  color: var(--text);
}

.detail-page .cards.four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.textarea:focus {
  outline: 2px solid rgba(110, 168, 255, 0.18);
  border-color: rgba(110, 168, 255, 0.32);
}

.input,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.input:focus,
.select:focus {
  outline: 2px solid rgba(110, 168, 255, 0.18);
  border-color: rgba(110, 168, 255, 0.32);
}

.profile-grid {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 10px;
}

.avatar-slot {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.avatar-placeholder {
  min-height: 144px;
  border: 1px dashed rgba(145, 172, 214, 0.26);
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  color: #8ba2c7;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.profile-fields {
  display: grid;
  gap: 8px;
  align-content: start;
}

.chat-thread {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.bubble {
  border: 1px solid rgba(145, 172, 214, 0.12);
  border-radius: var(--r-md);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.bubble.user {
  border-color: rgba(110, 168, 255, 0.24);
  background: rgba(74, 119, 226, 0.16);
}

.bubble-role {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.studio-root {
  border: 1px dashed rgba(145, 172, 214, 0.24);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.025);
  min-height: 120px;
  padding: 12px;
  display: grid;
  gap: 4px;
  align-content: center;
}

.code-block {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(3, 10, 22, 0.6);
  padding: 10px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace;
  font-size: 11px;
  color: #dce7fa;
}

.event-log {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
}

.event-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  padding: 8px;
  display: grid;
  gap: 3px;
  font-size: 12px;
}

@media (max-width: 1000px) {
  body {
    overflow: auto;
  }

  #app {
    height: auto;
    min-height: 100%;
  }

  .shell {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    max-height: none;
    padding-right: 0;
    margin-right: 0;
  }

  .app-sidebar-bottom {
    margin-top: 8px;
  }

  .main {
    height: auto;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .content {
    overflow: visible;
    padding: 10px 10px 14px;
  }

  .welcome-hero {
    grid-template-columns: 1fr;
  }

  .square-layout {
    grid-template-columns: 1fr;
  }

  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards.two,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .cards.three,
  .cards.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-sidebar {
    padding: 12px 10px;
  }

  .app-sidebar-nav {
    grid-template-columns: 1fr;
  }

  .app-topbar {
    min-height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .app-topbar-left {
    width: 100%;
    justify-content: space-between;
  }

  .app-topbar-nav {
    display: none !important;
  }

  .app-topbar-right {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
  }

  .app-topbar-search {
    order: 1;
    width: 100%;
  }

  .app-topbar-search-input {
    width: 100% !important;
    min-width: 0;
    max-width: none;
  }

  .app-signout-btn {
    margin-left: auto;
  }

  .app-topbar-brand {
    font-size: 24px;
  }

  .content {
    padding-bottom: 12px;
  }

  .page-header h2 {
    font-size: 24px;
  }

  .hero-card,
  .welcome-hero {
    padding: 20px;
  }

  .hero-title {
    font-size: 25px;
  }

  .welcome-hero-copy h2 {
    font-size: clamp(30px, 9vw, 44px);
  }

  .hero-actions,
  .row.wrap {
    width: 100%;
  }

  .hero-actions .btn,
  .action-grid .btn,
  .row.wrap .btn {
    width: 100%;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .cards.three,
  .cards.four {
    grid-template-columns: 1fr;
  }

  .square-feed-card {
    min-height: 0;
  }

  .stat {
    min-height: 0;
  }

  .app-footer {
    height: auto;
    padding: 8px 12px;
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    font-size: 10px;
    letter-spacing: 0.05em;
  }
}
