/* Per-app styles: File Explorer, Chromium, Settings, Task Manager, Notepad, Terminal, Calculator, Paint */

/* ---------- File Explorer ---------- */
.fx {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  background: var(--canvas);
}

.fx-cmd {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 0 8px;
  border-bottom: 1px solid var(--stroke);
}

.fx-cmdbtn {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  white-space: nowrap;
  cursor: default;
}

.fx-cmdbtn:hover:not(:disabled) {
  background: var(--subtle);
}

.fx-cmdbtn:disabled {
  color: var(--text-3);
}

.fx-cmdbtn > .ico {
  width: 16px;
  height: 16px;
}

.fx-cmdbtn > .chev {
  width: 12px;
  height: 12px;
  margin-left: 2px;
}

.fx-accent {
  background: var(--card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--stroke);
  font-weight: 600;
  margin-right: 4px;
}

.fx-accent:hover:not(:disabled) {
  background: var(--card-hover);
}

.fx-binonly[hidden] {
  display: none;
}

.fx-sep {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--stroke-strong);
  opacity: 0.5;
}

.fx-spacer {
  flex: 1;
}

.fx-addr {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 46px;
  padding: 0 10px;
  border-bottom: 1px solid var(--stroke);
}

.fx-crumbs {
  flex: 1;
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--stroke);
  overflow: hidden;
  cursor: text;
}

.fx-crumb {
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  white-space: nowrap;
  cursor: default;
}

.fx-crumb:hover {
  background: var(--subtle);
}

.fx-crumb-sep .ico {
  width: 12px;
  height: 12px;
  color: var(--text-2);
}

.fx-crumb-spacer {
  flex: 1;
  height: 100%;
}

.fx-address-input {
  flex: 1;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--card);
  outline: none;
  user-select: text;
}

.fx-search {
  flex: none;
  width: 200px;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--stroke);
}

.fx-search > .ico {
  width: 14px;
  height: 14px;
  color: var(--text-2);
}

.fx-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  user-select: text;
}

.fx-main {
  flex: 1;
  min-height: 0;
  display: flex;
}

.fx-nav {
  width: 220px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px;
  overflow: auto;
  border-right: 1px solid var(--stroke);
}

.fx-nav-item,
.fx-tree-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  white-space: nowrap;
  cursor: default;
}

.fx-nav-item:hover,
.fx-tree-item:hover {
  background: var(--subtle);
}

.fx-nav-item.active,
.fx-tree-item.active {
  background: var(--subtle-press);
}

.fx-nav-item .ico,
.fx-tree-item .ico {
  width: 16px;
  height: 16px;
  color: #e8a317;
}

.fx-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.fx-tree-item {
  padding-right: 6px;
}

.fx-tree-arrow {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--text-2);
}

.fx-tree-arrow .ico {
  width: 12px;
  height: 12px;
}

.fx-nav-sep {
  height: 1px;
  margin: 6px 6px;
  background: var(--stroke);
}

.fx-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fx-head,
.fx-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px 150px 90px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.fx-head {
  flex: none;
  height: 30px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text-2);
  font-size: 12px;
}

.fx-hcell {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: default;
}

.fx-hcell:hover {
  background: var(--subtle);
}

.fx-hcell.sorted {
  color: var(--text);
}

.fx-sortind {
  font-size: 9px;
}

.fx-list {
  flex: 1;
  min-height: 0;
  padding: 4px;
  overflow: auto;
  outline: none;
}

.fx-row {
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: default;
}

.fx-row:hover {
  background: var(--subtle);
}

.fx-row.selected {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

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

.fx-ico .ico {
  width: 18px;
  height: 18px;
}

.fx-ico .is-folder {
  color: #e8a317;
}

.fx-ico .is-file {
  color: var(--text-2);
}

.fx-name-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fx-loc {
  margin-left: 8px;
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fx-date,
.fx-type,
.fx-size {
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fx-size {
  text-align: right;
}

.fx-rename {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--card);
  outline: none;
  user-select: text;
}

.fx-empty {
  padding: 40px 24px;
  color: var(--text-2);
  text-align: center;
}

.fx-list.large {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  padding: 10px;
}

.fx-tile {
  width: 124px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: default;
}

.fx-tile:hover {
  background: var(--subtle);
}

.fx-tile.selected {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.fx-tile-ico .ico {
  width: 48px;
  height: 48px;
}

.fx-tile-ico .is-folder {
  color: #e8a317;
}

.fx-tile-ico .is-file {
  color: var(--text-2);
}

.fx-tile-name {
  max-width: 100%;
  text-align: center;
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.fx-tile-sub {
  font-size: 11px;
  color: var(--text-2);
  text-align: center;
}

.fx-status {
  flex: none;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 10px 0 14px;
  border-top: 1px solid var(--stroke);
  color: var(--text-2);
  font-size: 12px;
}

.fx-status-sel {
  color: var(--text);
}

.fx-status .icon-btn {
  width: 26px;
  height: 26px;
}

@container (max-width: 640px) {
  .fx-nav,
  .fx-type {
    display: none;
  }

  .fx-head,
  .fx-row {
    grid-template-columns: 1fr 120px 70px;
  }
}

/* ---------- Chromium browser ---------- */
.sj {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  outline: none;
}

.sj-tabbar {
  flex: none;
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 8px 0;
  background: color-mix(in srgb, var(--canvas) 88%, #000 4%);
}

.sj-tabs {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.sj-tab {
  width: 220px;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 10px;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  flex: none;
  position: relative;
  cursor: default;
}

.sj-tab:hover {
  background: var(--subtle);
}

.sj-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 -1px 0 var(--stroke);
}

.sj-tab.loading .sj-fav .ico {
  animation: sj-spin 1s linear infinite;
}

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

.sj-fav .ico {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.sj-tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sj-tab-close {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
}

.sj-tab-close:hover {
  background: var(--subtle-press);
}

.sj-tab-close .ico {
  width: 10px;
  height: 10px;
}

.sj-newtab {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  flex: none;
}

.sj-newtab:hover {
  background: var(--subtle);
}

.sj-newtab .ico {
  width: 14px;
  height: 14px;
}

.sj-toolbar {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--card);
  border-bottom: 1px solid var(--stroke);
}

.sj-tool {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
}

.sj-tool:hover:not(:disabled) {
  background: var(--subtle);
}

.sj-tool:disabled {
  color: var(--text-3);
}

.sj-tool .ico {
  width: 16px;
  height: 16px;
}

.sj-omni {
  flex: 1;
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 12px;
  border-radius: 16px;
  background: var(--canvas);
  border: 1px solid transparent;
}

.sj-omni:focus-within {
  border-color: var(--accent);
  background: var(--card);
}

.sj-secure .ico {
  width: 14px;
  height: 14px;
  color: var(--text-2);
}

.sj-address {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
  user-select: text;
}

.sj-star {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
}

.sj-star:hover {
  background: var(--subtle);
}

.sj-star.on {
  color: var(--accent);
}

.sj-star .ico {
  width: 14px;
  height: 14px;
}

.sj-profile {
  width: 28px;
  height: 28px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  font-size: 12px;
}

.sj-bookmarks {
  flex: none;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  background: var(--card);
  border-bottom: 1px solid var(--stroke);
  overflow-x: auto;
}

.sj-bm-item {
  height: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
}

.sj-bm-item:hover {
  background: var(--subtle);
}

.sj-bm-letter {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.sj-progress {
  flex: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: sj-progress 1.1s linear infinite;
}

@keyframes sj-progress {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}

.sj-content {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #fff;
}

.sj-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.sj-frame[hidden] {
  display: none;
}

/* ---------- Settings ---------- */
.st {
  height: 100%;
  min-height: 0;
  display: flex;
  background: var(--canvas);
}

.st-nav {
  width: 250px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 10px 10px;
  overflow: auto;
}

.st-search {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--card);
  outline: none;
  user-select: text;
}

.st-navuser {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin-bottom: 4px;
}

.st-navname {
  font-size: 13px;
  font-weight: 600;
}

.st-avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 24px;
  font-weight: 600;
}

.st-avatar.small {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.st-navlist {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st-navitem {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: default;
}

.st-navitem:hover {
  background: var(--subtle);
}

.st-navitem.active {
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.st-navitem .ico {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.st-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 24px 32px 40px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.st-heading {
  margin: 0 0 6px;
  font: 600 28px/1.2 var(--font-display);
}

.st-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 16px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.st-card-title {
  margin: 12px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.st-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  padding: 6px 0;
}

.st-row + .st-row,
.st-card > .st-row + .st-row {
  border-top: 1px solid var(--stroke);
}

.st-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.st-title {
  font-size: 14px;
}

.st-sub,
.st-muted {
  color: var(--text-2);
  font-size: 12px;
}

.st-btns {
  display: flex;
  gap: 8px;
}

.st-empty {
  padding: 14px 0 18px;
  color: var(--text-2);
}

.st-kv {
  display: flex;
  flex-direction: column;
  padding: 4px 0 10px;
}

.st-kv-row {
  display: flex;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid var(--stroke);
}

.st-kv-row:last-child {
  border-bottom: 0;
}

.st-kv-k {
  width: 200px;
  color: var(--text-2);
}

.st-kv-v {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-sm);
}

.seg-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-left: 1px solid var(--stroke-strong);
  background: var(--control);
  cursor: default;
}

.seg-btn:first-child {
  border-left: 0;
}

.seg-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.seg-btn .ico {
  width: 14px;
  height: 14px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 0 12px;
}

.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--card);
  cursor: default;
}

.swatch[aria-pressed="true"] {
  border-color: var(--text);
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0 6px;
}

.wall-tile {
  height: 72px;
  display: flex;
  align-items: flex-end;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: #fff;
  cursor: default;
}

.wall-tile[aria-pressed="true"] {
  border-color: var(--accent);
}

.wall-label {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
}

.color-input {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* ---------- Task Manager ---------- */
.tm {
  height: 100%;
  min-height: 0;
  display: flex;
  background: var(--canvas);
}

.tm-nav {
  width: 200px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border-right: 1px solid var(--stroke);
}

.tm-navitem {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: default;
}

.tm-navitem:hover {
  background: var(--subtle);
}

.tm-navitem.active {
  background: var(--subtle-press);
}

.tm-navitem .ico {
  width: 16px;
  height: 16px;
}

.tm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 0;
  overflow: hidden;
}

.tm-title {
  font: 600 22px/1.2 var(--font-display);
  margin-bottom: 12px;
}

.tm-head,
.tm-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 120px 90px 110px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.tm-head {
  height: 30px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text-2);
  font-size: 12px;
}

.tm-hcell {
  height: 100%;
  padding: 0 6px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: default;
}

.tm-hcell.sorted {
  color: var(--text);
  font-weight: 600;
}

.tm-hcell:hover {
  background: var(--subtle);
}

.tm-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.tm-group {
  padding: 12px 10px 4px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.tm-row {
  height: 32px;
  border-radius: var(--radius-sm);
}

.tm-row:hover {
  background: var(--subtle);
}

.tm-row.selected {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.tm-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tm-name .ico {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.tm-status {
  font-size: 12px;
}

.tm-status.muted {
  color: var(--text-2);
}

.tm-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tm-footer {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--stroke);
  margin: 0 -18px;
  padding: 0 18px;
  color: var(--text-2);
  font-size: 12px;
}

.tm-spacer {
  flex: 1;
}

.tm-perf {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-bottom: 18px;
}

.tm-pcard {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.tm-phead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--text-2);
}

.tm-big {
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
}

.tm-graph {
  width: 100%;
  height: 120px;
  margin: 8px 0;
}

.tm-area {
  fill: color-mix(in srgb, var(--accent) 20%, transparent);
}

.tm-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.tm-kv {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--text-2);
}

.tm-kv b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Notepad ---------- */
.menubar {
  display: flex;
  gap: 2px;
  padding: 3px 6px;
  border-bottom: 1px solid var(--stroke);
  background: var(--canvas);
}

.menu-btn {
  padding: 4px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.menu-btn:hover {
  background: var(--subtle);
}

.status-bar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 4px 12px;
  border-top: 1px solid var(--stroke);
  background: var(--canvas);
  color: var(--text-2);
  font-size: 12px;
}

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

.np-text {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  outline: none;
  resize: none;
  background: var(--card);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  user-select: text;
}

/* ---------- Terminal (always dark, like a console) ---------- */
.term {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  overflow: auto;
  background: #0c0c0c;
  color: #cccccc;
  font: 13px/1.45 var(--mono);
  cursor: text;
  user-select: text;
}

.term-out {
  white-space: pre-wrap;
  word-break: break-word;
}

.term-err {
  color: #f14c4c;
}

.term-line {
  display: flex;
  align-items: center;
}

.term-prompt {
  white-space: pre;
}

.term-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  outline: none;
  caret-color: #cccccc;
  font: inherit;
}

/* ---------- Calculator ---------- */
.calc {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 12px 12px;
  outline: none;
  background: var(--canvas);
}

.calc-display {
  flex: none;
  min-height: 92px;
  padding: 8px 6px 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: right;
}

.calc-expr {
  min-height: 18px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calc-result {
  overflow: hidden;
  font: 600 40px/1.15 var(--font-display);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calc-result.is-error {
  color: var(--danger);
  font-size: 15px;
}

.calc-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
}

.calc-key {
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  font-size: 17px;
  cursor: default;
  box-shadow: var(--shadow-card);
}

.calc-key:hover {
  background: var(--card-hover);
}

.calc-key:active {
  transform: scale(0.98);
}

.calc-key.fn {
  color: var(--text);
  font-size: 15px;
  background: color-mix(in srgb, var(--card) 70%, var(--canvas));
}

.calc-key.eq {
  background: var(--accent);
  color: var(--accent-text);
}

.calc-key.eq:hover {
  background: var(--accent-hover);
}

/* ---------- Paint ---------- */
.pt {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--stroke);
}

.pt-sep {
  width: 1px;
  height: 24px;
  background: var(--stroke-strong);
  opacity: 0.5;
}

.pt-tool[aria-pressed="true"] {
  background: var(--subtle-press);
  color: var(--accent);
}

.pt-palette {
  display: grid;
  grid-template-columns: repeat(8, 16px);
  gap: 2px;
}

.pt-swatch {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid var(--stroke-strong);
  border-radius: 2px;
}

.pt-swatch[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.pt-size {
  width: 110px;
  accent-color: var(--accent);
}

.pt-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  background: #808080;
}

.pt-canvas {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  cursor: crosshair;
  touch-action: none;
}

.pt-canvas:focus {
  outline: none;
}

/* Focus rings are drawn by the components, so the browser ring is hidden in these fields. */
.term-input:focus-visible,
.np-text:focus-visible,
.calc:focus-visible,
.fx-address input:focus-visible,
.fx-list:focus-visible,
.fx-rename:focus-visible,
.sj:focus-visible,
.sj-address:focus-visible {
  outline: none;
}
