.app-chrome {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.app-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--win-header);
}
.app-toolbar .spacer { flex: 1; }
.tool-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tool-btn:hover { background: var(--bg-hover); }
.tool-btn.on { background: var(--bg-selected); }
.tool-btn[disabled] { opacity: 0.4; cursor: default; }
.tool-btn svg { width: 16px; height: 16px; fill: currentColor; }

.split {
  flex: 1;
  display: grid;
  min-height: 0;
}
.split.files { grid-template-columns: 196px 1fr; }
.split.settings { grid-template-columns: 220px 1fr; }

.sidebar {
  background: color-mix(in srgb, var(--win-header) 86%, var(--win-bg));
  border-right: 1px solid var(--border);
  padding: 8px;
  overflow: auto;
}
.side-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  padding: 8px 10px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.side-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  text-align: left;
  color: var(--fg);
}
.side-item:hover { background: var(--bg-hover); }
.side-item.active { background: var(--bg-selected); }
.side-item svg, .side-item .app-icon { width: 16px; height: 16px; }

.crumb {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.crumb button {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--fg-dim);
}
.crumb button:hover { background: var(--bg-hover); }
.crumb button.here { color: var(--fg); font-weight: 500; }
.crumb .sep { color: var(--fg-faint); }

.files-main { display: flex; flex-direction: column; min-height: 0; }
.files-view { flex: 1; overflow: auto; padding: 8px; }
.files-status {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
}
.file-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
}
.file-tile:hover { background: var(--bg-hover); }
.file-tile.selected { background: var(--bg-selected); }
.file-tile .fico { width: 48px; height: 48px; }
.file-tile span {
  font-size: 12px;
  text-align: center;
  word-break: break-word;
  max-width: 88px;
}

.file-list { display: flex; flex-direction: column; }
.file-row {
  display: grid;
  grid-template-columns: 28px 1fr 90px 120px;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
}
.file-row:hover { background: var(--bg-hover); }
.file-row.selected { background: var(--bg-selected); }
.file-row .fico { width: 22px; height: 22px; }
.file-row small { color: var(--fg-muted); }

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--fg-muted);
  padding: 32px;
}
.empty-state h4 { margin: 0 0 6px; color: var(--fg-dim); font-weight: 500; }
.empty-state p { margin: 0; }

.editor-area {
  flex: 1;
  min-height: 0;
  border: 0;
  resize: none;
  padding: 14px 16px;
  background: var(--win-bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  user-select: text;
}
.dirty-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: none;
}
.dirty-dot.on { display: inline-block; }

.term {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
  background: #300a24;
  color: #eeeeec;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.4;
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
}
html[data-theme="light"] .term { background: #300a24; }
.term .prompt { color: #8ae234; }
.term .path { color: #729fcf; }
.term .err { color: #ef2929; }
.term .ok { color: #8ae234; }
.term .muted { color: #ad7fa8; }
.term .accent { color: #fcaf3e; }
.term input.cmdline {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  width: calc(100% - 2ch);
  outline: none;
  padding: 0;
  user-select: text;
}
.neofetch { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.neofetch pre { margin: 0; color: #e95420; }

.settings-main { overflow: auto; padding: 18px 22px 28px; }
.settings-main h2 { margin: 0 0 6px; font-size: 22px; font-weight: 500; }
.settings-main .lead { margin: 0 0 18px; color: var(--fg-muted); }
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.row + .row { border-top: 1px solid var(--border); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.swatch.on { border-color: var(--fg); }
.papers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.paper {
  height: 88px;
  border-radius: 10px;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
}
.paper.on { border-color: var(--accent); }

.toggle {
  width: 42px; height: 24px; border-radius: 12px;
  background: #5a5a5a;
  position: relative;
}
.toggle.on { background: var(--accent); }
.toggle i {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 140ms ease;
}
.toggle.on i { left: 20px; }

.about-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 0 16px;
}
.about-hero .logo { width: 72px; height: 72px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--fg-muted); }

.calc {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  background: var(--win-bg);
}
.calc-display {
  padding: 18px 16px 10px;
  text-align: right;
  font-size: 36px;
  font-weight: 400;
  min-height: 72px;
  word-break: break-all;
  user-select: text;
}
.calc-sub { text-align: right; padding: 0 16px 8px; color: var(--fg-muted); min-height: 20px; }
.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
}
.calc-keys button {
  height: 48px;
  border-radius: 10px;
  background: var(--bg-hover);
  font-size: 18px;
}
.calc-keys button:hover { background: var(--bg-active); }
.calc-keys .op { background: color-mix(in srgb, var(--accent) 22%, var(--bg-hover)); }
.calc-keys .eq { background: var(--accent); color: var(--accent-fg); }

.browser { display: flex; flex-direction: column; height: 100%; }
.tabstrip {
  display: flex;
  align-items: end;
  gap: 4px;
  padding: 6px 8px 0;
  background: var(--win-header);
}
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  max-width: 200px;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--fg-dim);
}
.tab.on { background: var(--win-bg); color: var(--fg); }
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .x { opacity: 0.5; }
.addr {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.addr input {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  padding: 0 10px;
  user-select: text;
}
.browse-page {
  flex: 1;
  overflow: auto;
  padding: 28px;
  background: var(--win-bg);
}
.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.start-tile {
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-hover);
  text-align: left;
}
.start-tile:hover { background: var(--bg-active); }

.store-hero {
  margin: 8px 12px 12px;
  padding: 22px;
  border-radius: 16px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 55%, #2c001e), #2c001e);
  color: #fff;
}
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 0 12px 16px;
}
.store-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-hover);
  text-align: left;
}
.store-card .app-icon { width: 48px; height: 48px; }

.clocks { padding: 16px; display: grid; gap: 10px; }
.clock-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-hover);
}
.big-time { font-size: 42px; font-variant-numeric: tabular-nums; }

.viewer {
  flex: 1;
  display: grid;
  place-items: center;
  background: #111;
  overflow: hidden;
}
.viewer img, .viewer svg { max-width: 100%; max-height: 100%; }

.mon-bars { display: grid; gap: 10px; padding: 14px; }
.mon-bar { height: 10px; border-radius: 5px; background: var(--bg-hover); overflow: hidden; }
.mon-bar > i { display: block; height: 100%; background: var(--accent); }
.proc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.proc-table th, .proc-table td { padding: 6px 10px; text-align: left; }
.proc-table tr:hover td { background: var(--bg-hover); }

input[type="range"] { accent-color: var(--accent); width: 160px; }
input[type="text"], input[type="search"], input[type="password"] { user-select: text; }

.wifi-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.wifi-row + .wifi-row { border-top: 1px solid var(--border); }
.wifi-row .sig { width: 18px; }

.preview-pane {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
  user-select: text;
  white-space: pre-wrap;
  font-family: var(--mono);
}
.preview-img { width: 100%; height: 100%; display: grid; place-items: center; background: #111; }
