/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #edf1f6;
  --text: #0e1525;
  --text-2: #3f4a5c;
  --text-3: #5f6a7d;
  --line: #e3e8ef;
  --line-2: #d2dae5;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-text: #ffffff;
  --accent-soft: #eef0ff;
  --good: #0b7a55;
  --good-soft: #e4f6ee;
  --warn: #9a5b00;
  --warn-soft: #fff3df;
  --bad: #c02626;
  --bad-soft: #fdecec;
  --on-bad: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 16px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c11;
  --surface: #11141b;
  --surface-2: #151922;
  --surface-3: #1b202b;
  --text: #e9edf5;
  --text-2: #b3bcca;
  --text-3: #8b95a7;
  --line: #232a37;
  --line-2: #2f3847;
  --accent: #8b93ff;
  --accent-hover: #a5abff;
  --accent-text: #0b0d18;
  --accent-soft: #1b1e36;
  --good: #4ade80;
  --good-soft: #10241c;
  --warn: #fbbf24;
  --warn-soft: #2a2010;
  --bad: #f87171;
  --bad-soft: #2a1414;
  --on-bad: #1a0b0b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ---------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: var(--accent);
}

::selection {
  background: var(--accent);
  color: var(--accent-text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono {
  font-family: var(--mono);
}

/* ---------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.boot .brand-mark {
  animation: breathe 1.5s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.97);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------------------------------------------------------------- brand */

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-text);
  flex: none;
}

.brand-mark .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.brand-mark--lg {
  width: 44px;
  height: 44px;
  border-radius: 13px;
}

.brand-mark--lg .icon {
  width: 25px;
  height: 25px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 6px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
}

.brand-text {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

/* ---------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100dvh;
  padding: 18px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-link .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: color 0.14s ease;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

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

.nav-count {
  margin-left: auto;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.nav-count:empty {
  display: none;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.server-mini {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.mini-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mini-name {
  font-size: 11.8px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-sub {
  margin-top: 2px;
  padding-left: 14px;
  color: var(--text-3);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-tools {
  display: flex;
  gap: 3px;
}

.main {
  min-width: 0;
}

.view {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px 72px;
}

/* ---------------------------------------------------------------- page head */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.027em;
}

.page-sub {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
}

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

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: 0;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    opacity 0.15s ease;
}

.btn .icon {
  width: 15px;
  height: 15px;
}

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

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

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--bad);
  color: var(--on-bad);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-block {
  width: 100%;
  height: 42px;
  font-size: 13.5px;
}

.btn-sm {
  height: 30px;
  padding: 0 9px;
  font-size: 11.8px;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
  transition: background-color 0.14s ease, color 0.14s ease;
}

.icon-btn .icon {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------------------------------------------------------------- cards / stats */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  min-width: 0;
  padding: 14px 16px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label .icon {
  width: 14px;
  height: 14px;
}

.spark {
  width: 64px;
  height: 22px;
  overflow: visible;
  opacity: 0.8;
}

.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 9px;
  font-size: 26px;
  font-weight: 660;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-value .unit {
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
}

.stat-sub {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meter {
  height: 4px;
  margin-top: 13px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

.meter.is-warn span {
  background: var(--warn);
}

.meter.is-bad span {
  background: var(--bad);
}

/* ---------------------------------------------------------------- files hero */

.files-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: radial-gradient(520px 220px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow);
}

.files-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.files-hero-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}

.files-hero-icon .icon {
  width: 23px;
  height: 23px;
}

.files-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.files-kicker .chip {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.files-hero h2 {
  margin: 5px 0 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.files-hero p {
  max-width: 470px;
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
}

.files-hero-side {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  flex: none;
}

.storage {
  width: 190px;
}

.storage-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--text-3);
  font-size: 11px;
}

.storage-row strong {
  color: var(--text-2);
  font-weight: 600;
}

.storage .meter {
  margin-top: 0;
}

.files-hero-action {
  flex: none;
}

.files-hero-action .btn {
  height: 40px;
  padding: 0 16px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- layout blocks */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.card-head p {
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.text-link .icon {
  width: 13px;
  height: 13px;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------------------------------------------------------------- services list */

.svc-list {
  display: flex;
  flex-direction: column;
}

.svc-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  text-align: left;
  transition: background-color 0.12s ease;
}

.svc-row:first-child {
  border-top: 0;
}

.svc-row:hover {
  background: var(--surface-2);
}

.svc-row > .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.svc-info {
  flex: 1;
  min-width: 0;
}

.svc-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.8px;
  font-weight: 550;
}

.svc-meta {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-3);
}

.dot--running {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-soft);
}

.dot--partial {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.dot--stopped {
  background: var(--text-3);
  box-shadow: 0 0 0 3px var(--surface-3);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}

.pill .dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.pill--running {
  background: var(--good-soft);
  color: var(--good);
}

.pill--running .dot {
  background: var(--good);
}

.pill--partial {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill--partial .dot {
  background: var(--warn);
}

.pill--stopped {
  background: var(--surface-3);
  color: var(--text-3);
}

.pill--stopped .dot {
  background: var(--text-3);
}

.pill--bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* ---------------------------------------------------------------- facts */

.facts {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 2px 16px 10px;
}

.fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.fact:last-child {
  border-bottom: 0;
}

.fact dt {
  color: var(--text-3);
  flex: none;
}

.fact dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.fact dd.mono {
  font-size: 11.5px;
}

/* ---------------------------------------------------------------- apps */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(296px, 1fr));
  gap: 14px;
}

.app-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 16px 0;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.app-icon .icon {
  width: 17px;
  height: 17px;
}

.app-title-wrap {
  flex: 1;
  min-width: 0;
}

.app-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  min-height: 22px;
}

.app-title .pill {
  font-size: 10.5px;
}

.app-head > .pill {
  margin-left: auto;
}

.app-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
  margin: 6px 16px 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

.app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 11px 16px 14px;
}

.app-domain {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 26px;
  padding: 0 16px 11px;
  font-size: 11.5px;
}

.domain-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
}

.domain-add .icon {
  width: 14px;
  height: 14px;
}

.domain-add:hover {
  color: var(--accent);
}

.domain-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  text-decoration: none;
}

.domain-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.domain-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-link .icon {
  width: 13px;
  height: 13px;
}

.domain-edit {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 550;
}

.domain-edit:hover {
  color: var(--accent);
}

.domain-current {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
}

.domain-current a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: none;
}

.domain-current a:hover {
  text-decoration: underline;
}

.domain-current .icon {
  width: 14px;
  height: 14px;
}

.modal-foot .spacer {
  flex: 1;
}

.chip {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.app-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: auto;
  padding: 6px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.app-foot .spacer {
  flex: 1;
}

.foot-note {
  padding-left: 9px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10.5px;
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 11.8px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.13s ease, color 0.13s ease;
}

.act .icon {
  width: 14px;
  height: 14px;
}

.act:hover {
  background: var(--surface-2);
  color: var(--text);
}

.act--accent {
  color: var(--accent);
}

.act--accent:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.act.is-danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.act:disabled {
  opacity: 0.5;
  cursor: default;
}

.catalog-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
}

.catalog-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
}

.catalog-note code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- empty / banner */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 24px;
  text-align: center;
}

.empty--card {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-3);
}

.empty-icon .icon {
  width: 20px;
  height: 20px;
}

.empty h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.empty p {
  max-width: 350px;
  margin: 0;
  color: var(--text-3);
  font-size: 12.5px;
}

.empty .btn {
  margin-top: 12px;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
}

.banner--bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.banner .icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

.banner .btn {
  margin-left: auto;
  flex: none;
}

/* ---------------------------------------------------------------- files */

.files-shell {
  position: relative;
  overflow: hidden;
  min-height: 280px;
}

.files-shell.is-dragging {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.files-shell.is-dragging::after {
  content: "Drop files to upload";
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  background: var(--surface-2);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.breadcrumbs > .icon {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--text-3);
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.crumb .icon {
  width: 14px;
  height: 14px;
}

.crumb:hover {
  background: var(--surface-3);
  color: var(--text);
}

.crumb.is-current {
  color: var(--text);
  font-weight: 600;
}

.files-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.files-count {
  color: var(--text-3);
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.upload-progress {
  padding: 9px 16px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-soft);
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 550;
}

.upload-progress-head span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.upload-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.15s linear;
}

.files-headrow,
.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 140px 104px;
  align-items: center;
}

.files-headrow {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.files-list {
  display: flex;
  flex-direction: column;
}

.file-row {
  min-height: 45px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.1s ease;
}

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

.file-row:hover {
  background: var(--surface-2);
}

.file-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

.file-main:hover .file-name {
  color: var(--accent);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
}

.file-icon .icon {
  width: 15px;
  height: 15px;
}

.file-icon--folder {
  background: var(--accent-soft);
  color: var(--accent);
}

.file-icon--image {
  color: #7c3aed;
}

.file-icon--video {
  color: #c2410c;
}

.file-icon--audio {
  color: #0e7490;
}

.file-icon--archive {
  color: #a16207;
}

.file-icon--code {
  color: #1d4ed8;
}

[data-theme="dark"] .file-icon--image {
  color: #c4b5fd;
}

[data-theme="dark"] .file-icon--video {
  color: #fdba74;
}

[data-theme="dark"] .file-icon--audio {
  color: #67e8f9;
}

[data-theme="dark"] .file-icon--archive {
  color: #fcd34d;
}

[data-theme="dark"] .file-icon--code {
  color: #93c5fd;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.8px;
  font-weight: 500;
  transition: color 0.12s ease;
}

.file-size,
.file-date {
  color: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.file-row:hover .file-actions,
.file-row:focus-within .file-actions {
  opacity: 1;
}

@media (hover: none) {
  .file-actions {
    opacity: 1;
  }
}

.file-act {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-3);
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.file-act .icon {
  width: 14px;
  height: 14px;
}

.file-act:hover {
  background: var(--surface-3);
  color: var(--text);
}

.file-act.is-danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.file-row--skeleton {
  opacity: 0.65;
}

.files-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 11.5px;
}

.files-foot .icon {
  width: 13px;
  height: 13px;
}

.files-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 56px 24px;
  text-align: center;
}

.files-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  border: 1px dashed var(--line-2);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text-3);
}

.files-empty-icon .icon {
  width: 24px;
  height: 24px;
}

.files-empty h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.files-empty p {
  max-width: 320px;
  margin: 0;
  color: var(--text-3);
  font-size: 12.5px;
}

.files-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.preview-image {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.preview-image img {
  display: block;
  max-width: 100%;
  max-height: min(60vh, 560px);
  border-radius: 8px;
}

.preview-text {
  max-height: min(56vh, 520px);
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 12px;
  background: #0a0d14;
  color: #c7d2e0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--text-3);
  font-size: 11px;
}

.preview-meta .mono {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
}

.preview-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 12px 18px;
  text-align: center;
}

.preview-info h3 {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.preview-info p {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
}

/* ---------------------------------------------------------------- skeleton */

.skeleton {
  border-color: transparent !important;
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  box-shadow: none !important;
  color: transparent !important;
}

.skeleton .icon {
  visibility: hidden;
}

.sk-line {
  height: 12px;
  border-radius: 6px;
}

.sk-stat {
  height: 118px;
}

.sk-card {
  height: 176px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---------------------------------------------------------------- login */

.login-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  overflow: hidden;
  background: radial-gradient(900px 420px at 50% -8%, var(--accent-soft), transparent 70%), var(--bg);
}

.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.32;
  -webkit-mask-image: radial-gradient(620px 400px at 50% 18%, #000, transparent 76%);
  mask-image: radial-gradient(620px 400px at 50% 18%, #000, transparent 76%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(380px, 100%);
  padding: 30px 28px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 30px 80px -28px rgba(15, 23, 42, 0.28);
}

.login-card h1 {
  margin: 18px 0 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.login-sub {
  margin: 4px 0 22px;
  color: var(--text-3);
  font-size: 13px;
}

.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 550;
}

.field {
  position: relative;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 42px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
}

.field-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.field-eye .icon,
.field-btn .icon {
  width: 17px;
  height: 17px;
}

.form-error {
  margin: 10px 0 0;
  color: var(--bad);
  font-size: 12.5px;
}

.login-card .btn-block {
  margin-top: 14px;
}

.login-foot {
  margin: 20px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
  text-align: center;
}

/* ---------------------------------------------------------------- modal */

.modal {
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(8, 11, 18, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  animation: rise 0.18s ease-out;
}

.modal--wide .modal-card {
  width: min(820px, calc(100vw - 32px));
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.modal-head p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.modal-body {
  overflow: auto;
  padding: 0 20px 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 18px 18px;
  background: var(--surface-2);
}

.modal-lead {
  margin: 2px 0 16px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
}

.modal-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--text-3);
  font-size: 12.5px;
}

.modal-list li {
  display: flex;
  gap: 7px;
  padding: 4px 0;
}

.modal-list .icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--good);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row label {
  font-size: 12px;
  font-weight: 550;
}

.form-row .hint {
  color: var(--text-3);
  font-size: 11.5px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
}

.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.logs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.logs-toolbar .hint {
  color: var(--text-3);
  font-size: 11.5px;
}

.logs-actions {
  display: flex;
  gap: 5px;
}

.logs {
  max-height: min(58vh, 520px);
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid #1d2430;
  border-radius: 12px;
  background: #0a0d14;
  color: #c7d2e0;
  font-family: var(--mono);
  font-size: 11.3px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(370px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 44px -14px rgba(0, 0, 0, 0.4);
  font-size: 12.5px;
  animation: toast-in 0.18s ease-out;
}

.toast .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: none;
  color: var(--accent);
}

.toast--ok .icon {
  color: var(--good);
}

.toast--err .icon {
  color: var(--bad);
}

.toast-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1150px) {
  .files-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .files-hero-side {
    align-items: center;
    justify-content: space-between;
  }

  .storage {
    width: min(320px, 60%);
  }
}

@media (max-width: 1080px) {
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    height: auto;
    padding: 9px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    flex: 1;
    padding: 0;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    flex-direction: row;
    gap: 4px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    width: auto;
    height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .nav-count {
    margin-left: 2px;
  }

  .sidebar-foot {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    margin: 0;
  }

  .server-mini {
    display: none;
  }

  .side-tools {
    gap: 2px;
  }

  .view {
    padding: 20px 16px 64px;
  }

  .page-head {
    margin-bottom: 18px;
  }

  .page-head h1 {
    font-size: 21px;
  }

  .modal-card,
  .modal--wide .modal-card {
    width: calc(100vw - 24px);
  }

  .modal-body {
    padding: 0 16px 16px;
  }

  .modal-head {
    padding: 16px 16px 12px;
  }

  .modal-foot {
    padding: 12px 16px;
  }

  .field input,
  .input {
    font-size: 16px;
  }
}

@media (max-width: 760px) {
  .files-headrow {
    display: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) 126px;
    padding-right: 10px;
  }

  .file-size,
  .file-date {
    display: none;
  }

  .file-actions {
    opacity: 1;
  }

  .file-act {
    width: 40px;
    height: 40px;
  }

  .file-act .icon {
    width: 16px;
    height: 16px;
  }

  .files-count {
    display: none;
  }

  .files-empty {
    padding: 44px 18px;
  }
}

@media (max-width: 560px) {
  .files-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 18px;
  }

  .files-hero h2 {
    font-size: 18px;
  }

  .files-hero-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .files-hero-side {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .storage {
    width: 100%;
  }

  .files-hero-action .btn {
    width: 100%;
  }

  .files-toolbar {
    padding: 6px 8px 6px 10px;
  }

  .nav {
    gap: 2px;
  }

  .nav-link {
    gap: 7px;
    padding: 0 8px;
    font-size: 12px;
  }

  .nav-link .icon {
    width: 15px;
    height: 15px;
  }

  .files-shell {
    min-height: 240px;
  }

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

  .stat {
    padding: 12px 13px 13px;
  }

  .stat-value {
    font-size: 22px;
  }

  .spark {
    width: 52px;
  }

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

  .page-head {
    align-items: flex-start;
  }

  .page-head .head-actions {
    width: 100%;
  }

  .page-head .head-actions .btn {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .login-wrap {
    padding: 16px;
  }

  .login-card {
    padding: 26px 22px 20px;
  }

  .toasts {
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
