:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #171a21;
  --muted: #647080;
  --line: #d8e0ea;
  --blue: #1f66d1;
  --blue-dark: #194f9d;
  --green: #138a62;
  --red: #be3b35;
  --gold: #b98113;
  --shadow: 0 18px 48px rgba(22, 30, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.brand,
.top-actions {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #1f66d1;
  font-size: 0.8rem;
  letter-spacing: 0;
}

.top-actions {
  gap: 10px;
}

.nav-link {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-weight: 700;
}

.main {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 42px) 0 54px;
}

.auth-layout,
.admin-layout,
.vault-layout {
  display: grid;
  gap: 18px;
}

.auth-layout {
  width: min(100%, 480px);
  margin: 8vh auto 0;
}

.panel,
.toolbar,
.player,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(18px, 3vw, 28px);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.toolbar-group,
.button-row,
.row-actions,
.breadcrumb,
.stats-grid,
.field-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breadcrumb {
  align-items: center;
}

.crumb {
  border: 0;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--blue-dark);
  background: transparent;
  font-weight: 750;
}

.crumb[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

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

.hidden {
  display: none !important;
}

.field {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
}

.field-grid {
  align-items: end;
}

.field-grid .field {
  min-width: min(100%, 220px);
  flex: 1;
}

label {
  color: #303846;
  font-size: 0.88rem;
  font-weight: 780;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 102, 209, 0.22);
  outline-offset: 2px;
}

.button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 760;
}

.button.primary {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.button.primary:hover {
  background: var(--blue-dark);
}

.button.danger {
  border-color: rgba(190, 59, 53, 0.32);
  color: var(--red);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 0 9px;
  font-size: 0.88rem;
}

.notice {
  padding: 12px 14px;
  color: #243242;
  background: #f9fbff;
}

.notice.good {
  border-color: rgba(19, 138, 98, 0.25);
  color: #0d6548;
  background: #effaf5;
}

.notice.warn {
  border-color: rgba(185, 129, 19, 0.3);
  color: #744f08;
  background: #fff8e8;
}

.notice.bad {
  border-color: rgba(190, 59, 53, 0.28);
  color: var(--red);
  background: #fff2f1;
}

.browser {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table th,
.file-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.file-table th {
  color: var(--muted);
  background: #f9fbfd;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.file-table tr:last-child td {
  border-bottom: 0;
}

.item-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  font-weight: 760;
}

.item-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #44546a;
  font-size: 0.9rem;
  font-weight: 800;
}

.item-icon.folder {
  background: #b98113;
}

.item-icon.audio {
  background: #138a62;
}

.item-icon.video {
  background: #7d4cc2;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.progress-list {
  display: grid;
  gap: 8px;
}

.progress-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf2;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
}

.player {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.media-box video,
.media-box audio {
  width: 100%;
  max-height: min(70vh, 620px);
  border-radius: 8px;
  background: #111;
}

.share-output {
  display: grid;
  gap: 8px;
}

.share-output textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

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

.stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.stat strong {
  display: block;
  font-size: 1.35rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.45fr);
  gap: 18px;
  align-items: start;
}

.log-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 7px;
  padding-right: 2px;
}

.log-entry {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
}

.code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .toolbar,
  .toolbar-group,
  .row-actions {
    width: 100%;
  }

  .button,
  .nav-link {
    flex: 1;
  }

  .file-table,
  .file-table tbody,
  .file-table tr,
  .file-table td {
    display: block;
    width: 100%;
  }

  .file-table thead {
    display: none;
  }

  .file-table tr {
    border-bottom: 1px solid var(--line);
  }

  .file-table td {
    border-bottom: 0;
    padding: 10px 12px;
  }

  .stats-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}
