:root {
  --color-primary: #0066cc;
  --color-primary-focus: #0071e3;
  --color-primary-on-dark: #2997ff;
  --color-canvas: #ffffff;
  --color-parchment: #f5f5f7;
  --color-pearl: #fafafc;
  --color-tile-1: #272729;
  --color-tile-2: #2a2a2c;
  --color-tile-3: #252527;
  --color-black: #000000;
  --color-ink: #1d1d1f;
  --color-muted: #7a7a7a;
  --color-hairline: #e0e0e0;
  --shadow-product: rgba(0, 0, 0, 0.22) 3px 5px 30px 0;
  --font-display: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-text: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Skeleton pulse */
  --skeleton-bg: #e1e1e3;
  --skeleton-highlight: #f2f2f4;
}

[data-theme="dark"] {
  --color-canvas: #000000;
  --color-parchment: #1c1c1e;
  --color-pearl: #2c2c2e;
  --color-ink: #f5f5f7;
  --color-muted: #8e8e93;
  --color-hairline: #38383a;
  --skeleton-bg: #2c2c2e;
  --skeleton-highlight: #3a3a3c;
}

@keyframes skeleton-pulse {
  0% { background-color: var(--skeleton-bg); }
  50% { background-color: var(--skeleton-highlight); }
  100% { background-color: var(--skeleton-bg); }
}

.skeleton {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.highlight {
  background: rgba(255, 235, 59, 0.4);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.drag-over {
  border: 2px dashed var(--color-primary) !important;
  background: rgba(0, 102, 204, 0.05) !important;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-parchment);
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 102, 204, 0.03) 0, transparent 50%),
    radial-gradient(at 50% 0%, rgba(0, 102, 204, 0.05) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(0, 102, 204, 0.03) 0, transparent 50%);
  background-attachment: fixed;
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.374px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 0;
}

body[data-router-ready="false"] .global-nav,
body[data-router-ready="false"] .sub-nav,
body[data-router-ready="false"] .footer,
body[data-router-ready="false"] [data-page] {
  display: none !important;
}

body[data-router-ready="false"] [data-page="login"] {
  display: flex !important;
}

main {
  flex: 1;
}

button,
input,
textarea {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.global-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  color: #ffffff;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 280px;
}

.nav-left {
  justify-content: flex-start;
}

.nav-right {
  justify-content: flex-end;
}

.nav-center {
  flex: 1;
  max-width: 520px;
  margin: 0 24px;
}

.global-search {
  position: relative;
  width: 100%;
}

.global-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

.global-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 14px 10px 42px;
  color: #fff;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-search input:focus {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--color-primary-on-dark);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.2);
  outline: none;
}

.system-info {
  display: flex;
  gap: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.2px;
}

.info-item {
  white-space: nowrap;
}

.auth-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6e6e73;
}

.status-indicator.is-authorized {
  background: #30d158;
  box-shadow: 0 0 10px rgba(48, 209, 88, 0.4);
}

.status-indicator.is-locked {
  background: #ff453a;
  box-shadow: 0 0 10px rgba(255, 69, 58, 0.4);
}

.nav-button {
  border: 0;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-button-primary {
  background: var(--color-primary-on-dark);
  color: #fff;
}

.nav-button-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-button-danger {
  background: rgba(255, 69, 58, 0.15);
  color: #ff453a;
  border: 1px solid rgba(255, 69, 58, 0.2);
}

.nav-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.brand-mark,
.sub-links,
.auth-actions,
.cta-row,
.render-toolbar,
.panel-heading,
.card-toolbar,
.preset-row {
  display: flex;
  align-items: center;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-black);
  text-decoration: none;
}

.cloud-icon {
  color: var(--color-primary);
  filter: drop-shadow(0 2px 4px rgba(0, 113, 227, 0.2));
}

.sub-nav {
  position: sticky;
  top: 52px;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 0 40px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.sub-left, .sub-right {
  display: flex;
  align-items: center;
  gap: 48px;
}

.sub-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--color-black);
}

.sub-links {
  gap: 40px;
}

.sub-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 8px 4px;
}

.sub-links a:hover,
.sub-links a.is-active {
  color: var(--color-primary);
}

.sub-links a.is-active {
  font-weight: 600;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #333333;
  font-size: 12px;
  letter-spacing: -0.12px;
  white-space: nowrap;
}

.session-chip.is-authorized {
  border-color: rgba(0, 102, 204, 0.24);
  color: var(--color-primary);
}

.session-chip.is-locked {
  color: var(--color-muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 0.14s ease;
  white-space: nowrap;
}

.button:active {
  transform: scale(0.95);
}

.button:focus-visible {
  outline: 2px solid var(--color-primary-focus);
  outline-offset: 3px;
}

.button-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.button-secondary {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: transparent;
}

.button-small,
.button-pearl {
  min-height: 32px;
  padding: 7px 15px;
  font-size: 14px;
  letter-spacing: -0.224px;
}

.button-pearl {
  border: 3px solid rgba(0, 0, 0, 0.04);
  border-radius: 11px;
  background: var(--color-pearl);
  color: #333333;
}

.product-tile {
  min-height: 720px;
  padding: 80px 32px;
}

[data-page][hidden] {
  display: none !important;
}

.product-tile-light {
  background: var(--color-canvas);
}

.product-tile-parchment {
  background: var(--color-parchment);
}

.product-tile-dark,
.product-tile-dark-2 {
  color: #ffffff;
}

.product-tile-dark {
  background: var(--color-tile-1);
}

.product-tile-dark-2 {
  background: var(--color-tile-2);
}

.hero-section {
  display: grid;
  justify-items: center;
  gap: 54px;
  padding-top: 72px;
}

.tile-copy,
.section-head {
  width: min(100%, 980px);
  margin: 0 auto;
  text-align: center;
}

.tile-copy h1,
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 1.07;
  font-weight: 600;
  letter-spacing: -0.28px;
}

.tile-copy p {
  margin: 12px 0 0;
  font-size: 28px;
  line-height: 1.14;
  letter-spacing: 0.196px;
}

.cta-row {
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.product-render {
  width: min(100%, 1040px);
  overflow: hidden;
  border-radius: 18px;
  background: #fbfbfd;
  box-shadow: var(--shadow-product);
}

.render-toolbar {
  height: 46px;
  gap: 8px;
  padding: 0 18px;
  border-bottom: 1px solid var(--color-hairline);
}

.render-toolbar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #d2d2d7;
}

.render-toolbar strong {
  margin-left: 10px;
  font-size: 14px;
  font-weight: 600;
}

.render-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  padding: 24px;
}

.render-panel,
.utility-card,
.tool-card {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px) saturate(180%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.render-panel {
  min-height: 190px;
  padding: 32px;
}

.render-panel-wide {
  grid-row: span 2;
}

.render-panel-dark {
  background: var(--color-tile-3);
  color: #ffffff;
}

.panel-heading,
.card-toolbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.card-toolbar h3 + small {
  display: block;
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: -0.12px;
}

.toolbar-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-heading span,
.render-panel small,
.metric-strip small,
.tool-card span {
  color: var(--color-muted);
}

.render-panel-dark .panel-heading span {
  color: #cccccc;
}

.file-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--color-hairline);
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 52px;
  border-radius: 8px;
  background: var(--color-parchment);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.file-doc {
  color: #1d1d1f;
}

.workspace-section {
  min-height: 520px;
}

.section-head p {
  margin: 12px auto 0;
  max-width: 680px;
  font-size: 24px;
  font-weight: 300;
  line-height: 1.5;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: min(100%, 1120px);
  margin: 48px auto 0;
}

.metric-strip article {
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
}

.metric-strip span,
.metric-strip small {
  display: block;
}

.metric-strip strong {
  display: block;
  margin: 16px 0 4px;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.1;
  font-weight: 600;
}

.app-section {
  min-height: auto;
}

.utility-layout,
.memo-board,
.ai-workbench,
.tool-grid {
  width: min(100%, 1180px);
  margin: 48px auto 0;
}

.utility-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.utility-card {
  padding: 24px;
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-card label,
.card-toolbar h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: var(--color-canvas);
  color: var(--color-ink);
  padding: 12px 20px;
}

input[type="file"] {
  border-radius: 11px;
  background: var(--color-pearl);
}

.search-input {
  width: min(220px, 34vw);
  min-height: 36px;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  letter-spacing: -0.224px;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

.file-list,
.memo-list {
  display: grid;
  gap: 12px;
}

.data-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--color-hairline);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(210, 210, 215, 0.64);
  color: var(--color-ink);
  cursor: pointer;
}

.memo-board {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.memo-column {
  min-width: 0;
}

.memo-editor {
  display: grid;
  gap: 14px;
}

.memo-card {
  padding: 24px;
  border: 1px solid var(--color-hairline);
  border-radius: 18px;
  background: var(--color-canvas);
}

.memo-card.is-selected {
  border-color: rgba(0, 102, 204, 0.42);
  box-shadow: inset 0 0 0 1px rgba(0, 102, 204, 0.18);
}

.memo-card h3,
.ai-result h3,
.tool-card strong {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.memo-card p,
.ai-result p,
.upload-card p {
  margin: 8px 0 0;
  color: #333333;
}

.memo-card p {
  max-height: 150px;
  overflow: auto;
  padding-right: 6px;
}

.memo-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.memo-actions small {
  margin-right: auto;
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: -0.12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font-size: 14px;
  letter-spacing: -0.224px;
  cursor: pointer;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 42px 22px;
  border: 1px dashed var(--color-hairline);
  border-radius: 18px;
  color: var(--color-muted);
  text-align: center;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  opacity: 0.6;
}

.empty-state p {
  margin: 0;
}

.ai-workbench {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.prompt-panel,
.ai-result {
  border-radius: 18px;
  padding: 24px;
}

.prompt-panel {
  background: #ffffff;
  color: var(--color-ink);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.preset-row button {
  min-height: 40px;
  border: 1px solid var(--color-primary-on-dark);
  border-radius: 999px;
  background: transparent;
  color: var(--color-primary);
  padding: 8px 14px;
  cursor: pointer;
}

.ai-source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.source-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  letter-spacing: -0.224px;
}

.source-heading small {
  color: var(--color-muted);
}

.source-list {
  display: grid;
  gap: 8px;
  max-height: 172px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--color-hairline);
  border-radius: 18px;
  background: var(--color-pearl);
}

.source-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: center;
  padding: 8px;
  border-radius: 11px;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-size: 13px;
  letter-spacing: -0.12px;
}

.source-option input {
  width: auto;
  grid-row: span 2;
}

.source-option small,
.source-empty {
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: -0.12px;
}

.source-empty {
  margin: 0;
  padding: 8px;
}

.prompt-panel textarea {
  margin-bottom: 14px;
}

.ai-result {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--color-tile-3);
}

.ai-result span {
  display: block;
  margin-bottom: 12px;
  color: #cccccc;
  font-size: 14px;
}

.ai-result p {
  color: #ffffff;
  white-space: pre-wrap;
}

.markdown-body {
  color: #ffffff;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 18px 0 8px;
  color: #ffffff;
  font-family: var(--font-display);
  line-height: 1.18;
}

.markdown-body p,
.markdown-body li {
  color: #ffffff;
}

.markdown-body ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  width: min(100%, 1200px);
  margin: 40px auto 0;
}

.tool-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  padding: 24px;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 113, 227, 0.2);
}

.tool-card.is-selected {
  background: var(--color-parchment);
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.1);
}

.tool-card strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-black);
}

.tool-card span {
  font-size: 13px;
  color: var(--color-muted);
}

.tool-output {
  width: min(100%, 1200px);
  margin: 32px auto 60px;
  padding: 32px;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-panel h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.tool-panel pre {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 18px;
  border-radius: 18px;
  background: var(--color-parchment);
  color: var(--color-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.tool-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.tool-metrics article {
  padding: 18px;
  border: 1px solid var(--color-hairline);
  border-radius: 18px;
  background: var(--color-canvas);
}

.tool-metrics span {
  display: block;
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: -0.12px;
}

.tool-metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  width: min(100%, 1180px);
  margin: 48px auto 0;
}

.settings-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

.settings-note {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
}

.settings-card-wide {
  grid-column: 1 / -1;
}

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

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

.settings-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(140px, 0.5fr);
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--color-hairline);
}

.settings-row strong,
.settings-row span,
.settings-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row small {
  color: var(--color-muted);
}

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 56px;
  padding: 12px 20px;
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: blur(16px);
  color: #7a7a7a;
  font-size: 12px;
  letter-spacing: -0.12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.tool-options,
.tool-sub-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 10px;
}

.tool-options label,
.tool-sub-options label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.35;
  overflow: hidden;
}

.tool-options label span,
.tool-sub-options label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tool-sub-options {
  grid-template-columns: 1fr;
}

.tool-options label:hover,
.tool-sub-options label:hover {
  border-color: rgba(0, 102, 204, 0.24);
  background: rgba(0, 102, 204, 0.04);
}

.tool-options input,
.tool-sub-options input {
  flex: 0 0 auto;
}
.tool-input-group {
  display: grid;
  gap: 8px;
}
.tool-input-group label {
  font-size: 14px;
  font-weight: 600;
}

.tool-file-picker {
  display: grid;
  gap: 8px;
}

.tool-file-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.tool-file-picker select {
  min-width: 0;
}
.menu-result {
  padding: 32px;
  text-align: center;
  background: var(--color-pearl);
  border-radius: 18px;
  border: 1px dashed var(--color-primary);
}
.menu-result strong {
  font-size: 32px;
  color: var(--color-primary);
}

.login-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  background: #000;
  color: #fff;
  overflow: hidden;
}

.login-bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(0, 102, 204, 0.15) 0%, transparent 70%);
  z-index: 0;
}

.login-container {
  position: relative;
  width: min(100%, 420px);
  z-index: 1;
  text-align: center;
}

.login-brand {
  margin-bottom: 48px;
}

.brand-logo-large {
  margin-bottom: 24px;
}

.brand-logo-large .brand-glyph {
  width: 64px;
  height: 64px;
  border-width: 3px;
  margin: 0 auto;
}

.login-brand h1 {
  font-size: 42px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -1px;
}

.login-brand p {
  font-size: 19px;
  color: rgba(255, 255, 255, 0.6);
  margin: 8px 0 0;
}

.glass-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.login-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.login-tab.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.login-content {
  padding: 32px;
}

.login-panel {
  display: none;
  animation: fadeIn 0.4s ease;
}

.login-panel.active {
  display: block;
}

.login-illustration {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  color: var(--color-primary-on-dark);
}

.login-illustration svg {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border: 2px solid var(--color-primary-on-dark);
  border-radius: 50%;
  animation: pulse 2s infinite;
  z-index: 1;
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.login-panel h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
}

.login-panel p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
  margin-bottom: 32px;
}

.full-width {
  width: 100%;
}

.login-form {
  text-align: left;
  display: grid;
  gap: 20px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
  margin-left: 4px;
}

.login-form input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.login-form input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-primary-on-dark);
  outline: none;
}

.login-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}

.app-section {
  padding-bottom: 96px;
}
.button-large {
  width: 100%;
  min-height: 52px;
  font-size: 17px;
  font-weight: 600;
}

body:not(.is-authorized) .sub-nav,
body:not(.is-authorized) .footer {
  display: none !important;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--color-ink);
  color: #ffffff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 833px) {
  #nav-ip {
    display: none;
  }

  .nav-center {
    display: none;
  }

  .nav-left,
  .nav-right {
    min-width: 0;
    gap: 10px;
  }

  .system-info {
    gap: 10px;
    font-size: 12px;
  }

  .sub-nav {
    padding: 0 16px;
  }

  .sub-left {
    gap: 18px;
    min-width: 0;
    flex: 1;
  }

  .sub-links {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .sub-links::-webkit-scrollbar {
    display: none;
  }

  .sub-links a {
    font-size: 14px;
  }

  .product-tile {
    padding: 56px 20px;
  }

  .tile-copy h1,
  .section-head h2 {
    font-size: 40px;
  }

  .tile-copy p {
    font-size: 24px;
  }

  .render-grid,
  .utility-layout,
  .memo-board,
  .ai-workbench,
  .ai-source-grid,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .card-toolbar {
    align-items: flex-start;
  }

  .metric-strip,
  .tool-grid,
  .tool-metrics,
  .settings-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-card-wide {
    grid-column: auto;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 640px) {
  .global-nav {
    min-height: 44px;
    padding: 0 16px;
  }

  .global-nav .nav-left {
    display: none;
  }

  .global-nav .nav-right {
    width: 100%;
    justify-content: flex-end;
  }

  .sub-nav {
    top: 44px;
    min-height: 52px;
  }

  .auth-status {
    padding: 6px 10px;
  }

  .nav-button {
    padding: 8px 12px;
    font-size: 12px;
  }

  .brand-mark span:last-child {
    display: inline;
  }

  .sub-title {
    font-size: 17px;
    letter-spacing: 0;
  }

  .sub-links {
    display: none;
  }

  .tile-copy h1,
  .section-head h2 {
    font-size: 34px;
  }

  .tile-copy p,
  .section-head p {
    font-size: 21px;
  }

  .cta-row {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .toolbar-actions,
  .form-actions {
    width: 100%;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }

  .auth-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
    width: 100%;
  }

  .session-chip {
    grid-column: 1 / -1;
  }

  .metric-strip,
  .tool-grid,
  .tool-metrics,
  .settings-metrics {
    grid-template-columns: 1fr;
  }

  .data-row {
    grid-template-columns: 52px 1fr;
  }

  .row-actions {
    grid-column: 2;
  }

  .footer {
    min-height: 52px;
    font-size: 11px;
  }
}

/* Premium UI Enhancements */
.fade-in {
  animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.button:active {
  transform: translateY(0) scale(0.98);
}

.brand-mark span {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.5px;
}

.sub-nav {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.session-chip {
  transition: all 0.2s ease;
}

.session-chip:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 102, 204, 0.3);
}

/* Scrollbar refinements */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* Dark mode for AI results */
.ai-result {
  background: rgba(30, 30, 35, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  line-height: 1.6;
}

.ai-result h3 {
  color: var(--color-primary-on-dark);
}

.ai-result code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.data-row {
  transition: background 0.2s ease;
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 4px;
}

.data-row:hover {
  background: rgba(0, 102, 204, 0.03);
}

.memo-card {
  transition: all 0.2s ease;
  border-color: rgba(0, 0, 0, 0.05);
}

.memo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 102, 204, 0.2);
}

.login-section .button-large {
  height: 52px;
  font-size: 16px;
  font-weight: 600;
}

.memo-card p {
  white-space: pre-wrap;
}

/* Dashboard Section */
.dashboard-section {
  padding: 60px 40px !important;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 48px;
}

.dashboard-header h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1.2px;
  margin-bottom: 8px;
}

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

.quick-stats {
  display: flex;
  gap: 24px;
}

.stat-item {
  text-align: right;
}

.stat-item span {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-black);
}

.stat-item small {
  color: var(--color-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.dashboard-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 380px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  position: relative;
  overflow: hidden;
}

.dashboard-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 113, 227, 0.2);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  transition: transform 0.3s ease;
}

.dashboard-card:hover .card-icon {
  transform: scale(1.1);
}

.card-files .card-icon { background: rgba(0, 113, 227, 0.1); color: var(--color-primary); }
.card-memos .card-icon { background: rgba(255, 159, 10, 0.1); color: #ff9f0a; }
.card-ai .card-icon { background: rgba(175, 82, 222, 0.1); color: #af52de; }

.card-content {
  flex: 1;
}

.card-content h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-content p {
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 600;
  font-size: 14px;
  color: var(--color-primary);
}

.ai-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #af52de;
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #af52de;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(175, 82, 222, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(175, 82, 222, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(175, 82, 222, 0); }
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section {
    padding-bottom: 120px !important;
  }
}

/* Dashboard Quick Tools */
.dashboard-tools-section {
  margin-top: 80px;
  padding-top: 60px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.dashboard-tools-section .section-head {
  text-align: left;
  margin-bottom: 32px;
}

.dashboard-tools-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}

.quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.quick-tool-btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.quick-tool-btn:hover {
  transform: translateY(-2px);
  background: var(--color-parchment);
  border-color: var(--color-primary);
  box-shadow: 0 8px 16px rgba(0, 113, 227, 0.08);
}

.quick-tool-btn strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-black);
}

.stat-item span {
  font-size: 28px !important;
  color: var(--color-primary) !important;
}

/* Explorer Layout */
.explorer-layout {
  display: grid !important;
  grid-template-columns: 300px 1fr;
  align-items: start;
  gap: 24px;
}

.explorer-sidebar {
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-hairline);
}

.storage-selector {
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--color-hairline);
  background: var(--color-canvas);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tree-container {
  font-size: 14px;
}

.tree-node {
  display: flex;
  flex-direction: column;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item:hover {
  background: rgba(0, 102, 204, 0.05);
}

.tree-item.is-active {
  background: rgba(0, 102, 204, 0.1);
  color: var(--color-primary);
  font-weight: 600;
}

.tree-children {
  margin-left: 20px;
  border-left: 1px solid var(--color-hairline);
}

.explorer-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.loading-state {
  padding: 20px;
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
}

@media (max-width: 1024px) {
  .explorer-layout {
    grid-template-columns: 1fr;
  }
  .explorer-sidebar {
    position: static;
    max-height: none;
  }
}

/* Editor Overlay */
.memo-editor-overlay {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  border: 2px solid var(--color-primary);
  animation: fadeIn 0.3s ease;
}

.memo-editor-overlay textarea {
  min-height: 400px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
}
