:root {
  color-scheme: light;
  --ink: #162033;
  --ink-soft: #5f6b7d;
  --ink-faint: #8993a3;
  --line: #e5e9f0;
  --line-strong: #d8dee8;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-warm: #fbfaf7;
  --primary: #4d67e8;
  --primary-dark: #3b51c7;
  --primary-soft: #eef1ff;
  --accent: #f4b65d;
  --danger: #d9475c;
  --danger-soft: #fff0f2;
  --success: #2d9b73;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 14px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 18px 50px rgba(20, 30, 52, 0.14);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --font: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--surface-soft);
  font-family: var(--font);
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 85% -10%, rgba(77, 103, 232, 0.08), transparent 32rem),
    var(--surface-soft);
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(77, 103, 232, 0.22);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.muted {
  margin: 0;
  color: var(--ink-soft);
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: linear-gradient(145deg, #7188f5, #4058d2);
  box-shadow: 0 9px 24px rgba(77, 103, 232, 0.25);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-mark-large {
  width: 58px;
  height: 58px;
  margin-bottom: 34px;
  border-radius: 18px;
  font-size: 18px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button-primary {
  color: white;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(77, 103, 232, 0.18);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(77, 103, 232, 0.25);
}

.button-secondary {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(77, 103, 232, 0.12);
}

.button-secondary:hover:not(:disabled) {
  background: #e3e8ff;
}

.button-ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
}

.button-ghost:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-soft);
}

.button-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffd8de;
}

.button-danger:hover:not(:disabled) {
  color: #b92f45;
  background: #ffe3e8;
}

.button-large {
  min-height: 48px;
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-button:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(380px, 1.08fr) minmax(420px, 0.92fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  display: flex;
  min-height: 100vh;
  padding: clamp(56px, 8vw, 120px);
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(145deg, rgba(32, 44, 106, 0.2), rgba(32, 44, 106, 0)),
    linear-gradient(145deg, #3044aa 0%, #526be4 58%, #7187f0 100%);
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  pointer-events: none;
}

.login-brand::before {
  width: 520px;
  height: 520px;
  top: -160px;
  right: -180px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.025), 0 0 0 140px rgba(255, 255, 255, 0.02);
}

.login-brand::after {
  width: 300px;
  height: 300px;
  left: -120px;
  bottom: -130px;
  background: rgba(244, 182, 93, 0.18);
  filter: blur(2px);
}

.login-brand > * {
  position: relative;
  z-index: 1;
}

.login-brand .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.login-brand h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(42px, 5vw, 70px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.login-lead {
  max-width: 560px;
  margin: 26px 0 34px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 16px;
}

.login-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 650;
}

.login-feature-list span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.login-feature-list .icon {
  color: #ffe0a9;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  padding: 48px;
  place-items: center;
  background:
    radial-gradient(circle at 70% 25%, rgba(77, 103, 232, 0.07), transparent 22rem),
    var(--surface-warm);
}

.login-card {
  display: grid;
  width: min(100%, 410px);
  gap: 22px;
  padding: 44px;
  border: 1px solid rgba(219, 224, 234, 0.84);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.search-box,
.select-box select {
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input {
  width: 100%;
  height: 45px;
  padding: 0 13px;
}

.field input:focus,
.search-box:focus-within,
.select-box select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(77, 103, 232, 0.11);
}

.form-error {
  margin: -8px 0 0;
  padding: 10px 12px;
  border: 1px solid #ffd8de;
  border-radius: 9px;
  color: #a62f43;
  background: var(--danger-soft);
  font-size: 13px;
}

.login-note {
  margin: -7px 0 0;
  color: var(--ink-faint);
  text-align: center;
  font-size: 11px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 66px;
  padding: 0 clamp(20px, 4vw, 56px);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(226, 231, 239, 0.88);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.brand-row,
.topbar-actions {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-row > div {
  display: grid;
  line-height: 1.05;
}

.brand-row strong {
  font-size: 14px;
}

.brand-row span:not(.brand-mark) {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 11px;
}

.topbar-actions {
  gap: 8px;
}

.user-chip {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 750;
}

.page-shell {
  width: min(1460px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 70px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.page-heading h1 {
  margin: 0 0 5px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.stats-grid {
  display: grid;
  margin: 28px 0 22px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  min-height: 108px;
  padding: 20px;
  align-items: center;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-card-accent {
  border-color: rgba(77, 103, 232, 0.22);
  background: linear-gradient(140deg, #f9faff, #eef1ff);
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 18px;
}

.stat-card > div:last-child {
  display: grid;
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 12px;
}

.stat-card strong {
  margin-top: 2px;
  font-size: 23px;
  letter-spacing: -0.035em;
}

.resource-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  padding: 16px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: flex;
  width: min(100%, 430px);
  height: 40px;
  padding: 0 12px;
  align-items: center;
  gap: 9px;
  color: var(--ink-faint);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-box input::placeholder {
  color: #a5adba;
}

.select-box select {
  min-width: 128px;
  height: 40px;
  padding: 0 32px 0 12px;
  cursor: pointer;
}

.folder-browser {
  padding: 12px 18px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.folder-breadcrumb {
  display: flex;
  min-height: 32px;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
}

.breadcrumb-button {
  display: inline-flex;
  min-height: 30px;
  padding: 0 7px;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.breadcrumb-button:hover:not(.is-current) {
  color: var(--primary);
  background: var(--primary-soft);
}

.breadcrumb-button.is-current {
  color: var(--ink);
  cursor: default;
}

.breadcrumb-button:disabled,
.folder-card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.breadcrumb-separator {
  color: #b0b7c2;
}

.folder-grid {
  display: grid;
  margin-top: 10px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 9px;
}

.folder-card {
  display: flex;
  min-width: 0;
  min-height: 66px;
  padding: 11px 13px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.folder-card:hover:not(:disabled) {
  border-color: #cfd7ff;
  box-shadow: 0 7px 18px rgba(46, 62, 114, 0.08);
  transform: translateY(-1px);
}

.folder-card-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 18px;
}

.folder-card-content {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.folder-card-content strong,
.folder-card-content span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-content strong {
  font-size: 13px;
}

.folder-card-content span {
  color: var(--ink-faint);
  font-size: 11px;
}

.folder-card-arrow {
  color: var(--ink-faint);
  font-size: 20px;
}

.batch-toolbar {
  display: flex;
  min-height: 58px;
  padding: 9px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #dce2ff;
  background: var(--primary-soft);
}

.batch-toolbar > strong {
  color: var(--primary-dark);
  font-size: 12px;
}

.batch-toolbar > div {
  display: flex;
  gap: 8px;
}

.table-wrap {
  position: relative;
  min-height: 280px;
  overflow-x: auto;
}

.resource-table {
  width: 100%;
  min-width: 870px;
  border-collapse: collapse;
}

.resource-table th,
.resource-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: middle;
}

.resource-table th {
  color: var(--ink-faint);
  background: #fbfcfd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.resource-table tbody tr {
  transition: background 120ms ease;
}

.resource-table tbody tr:hover {
  background: #fafbff;
}

.resource-table tbody tr.is-selected,
.resource-table tbody tr.is-selected:hover {
  background: #f3f5ff;
}

.resource-table tbody tr:last-child td {
  border-bottom: 0;
}

.selection-column {
  width: 48px;
  padding-right: 0 !important;
  text-align: center !important;
}

.asset-checkbox,
#select-all-assets {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.asset-main {
  display: flex;
  min-width: 290px;
  align-items: center;
  gap: 13px;
}

.asset-thumb {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 21px;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-name {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.asset-name strong {
  max-width: 410px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.asset-name span {
  max-width: 410px;
  overflow: hidden;
  color: var(--ink-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.type-pill {
  display: inline-flex;
  padding: 5px 8px;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
  color: #4a5670;
  background: #f0f3f7;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.actions-column {
  width: 250px;
  text-align: right !important;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
}

.row-action {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.row-action:hover:not(:disabled) {
  color: var(--primary);
  border-color: #dfe4ff;
  background: var(--primary-soft);
}

.row-action-danger:hover:not(:disabled) {
  color: var(--danger);
  border-color: #ffd8de;
  background: var(--danger-soft);
}

.row-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-state {
  display: grid;
  min-height: 330px;
  padding: 50px 20px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 20px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 28px;
}

.empty-state h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  padding: 20px;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(19, 27, 43, 0.58);
  backdrop-filter: blur(5px);
}

.modal[open] {
  display: grid;
  place-items: center;
}

.modal-card {
  width: min(100%, 620px);
  max-height: calc(100vh - 40px);
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.modal-card-wide {
  width: min(100%, 720px);
}

.modal-card-users {
  width: min(100%, 940px);
}

.modal-header,
.modal-footer {
  display: flex;
  padding: 20px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.modal-footer {
  border-top: 1px solid var(--line);
}

.modal-footer > div {
  display: flex;
  gap: 8px;
}

.upload-path-field {
  padding: 20px 22px 0;
}

.field-hint {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 500;
}

.user-dialog-body {
  background: var(--surface-soft);
}

.user-create-panel,
.user-list-panel {
  padding: 22px;
}

.user-create-panel {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.section-heading {
  display: flex;
  margin-bottom: 17px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h3 {
  margin: 0 0 3px;
  font-size: 16px;
}

.section-heading .muted {
  font-size: 12px;
}

.user-form-grid {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(145px, 0.7fr);
  gap: 14px;
}

.checkbox-field {
  display: flex;
  min-height: 45px;
  padding: 7px 12px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  cursor: pointer;
  background: var(--surface);
}

.checkbox-field input,
.user-status-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.checkbox-field span {
  display: grid;
}

.checkbox-field strong {
  font-size: 12px;
}

.checkbox-field small {
  color: var(--ink-faint);
  font-size: 10px;
}

.user-create-footer {
  display: flex;
  min-height: 40px;
  margin-top: 14px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.user-create-footer .form-error {
  flex: 1;
  margin: 0;
}

.user-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.user-table {
  min-width: 760px;
}

.user-table .actions-column {
  width: 105px;
}

.user-name-cell {
  display: grid;
  min-width: 145px;
  gap: 5px;
}

.user-name-cell > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.account-badge {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 6px;
  color: #6b4b14;
  background: #fff3d8;
  font-size: 10px;
  font-weight: 750;
}

.account-badge-current {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.user-role-select {
  min-width: 108px;
  height: 36px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
}

.user-role-select:disabled {
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.user-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.user-status-toggle:has(input:checked) {
  color: var(--success);
}

.table-message {
  padding: 34px !important;
  color: var(--ink-faint);
  text-align: center !important;
}

.table-message.is-error {
  color: var(--danger);
}

.password-card {
  width: min(100%, 520px);
}

.password-form-body {
  display: grid;
  padding: 22px;
  gap: 16px;
}

.password-form-body .form-error {
  margin: 0;
}

.drop-zone {
  display: grid;
  min-height: 220px;
  margin: 22px;
  padding: 35px;
  place-items: center;
  align-content: center;
  border: 1.5px dashed #bfc8da;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-soft);
  background: #fafbfe;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.drop-zone strong {
  margin: 12px 0 4px;
  color: var(--ink);
  font-size: 16px;
}

.drop-zone span {
  font-size: 12px;
}

.upload-source-actions {
  display: flex;
  margin-top: 18px;
  gap: 8px;
}

.drop-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  color: var(--primary);
  background: white;
  box-shadow: var(--shadow-sm);
  font-size: 25px;
}

.upload-queue {
  display: grid;
  max-height: 300px;
  margin: -8px 22px 22px;
  gap: 8px;
  overflow-y: auto;
}

.upload-row {
  display: grid;
  padding: 11px 12px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.upload-file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 17px;
}

.upload-file-info {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.upload-file-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.upload-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 10px;
}

.progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: #ebeff5;
}

.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 100ms linear;
}

.upload-status {
  min-width: 42px;
  color: var(--ink-soft);
  text-align: right;
  font-size: 11px;
  font-weight: 700;
}

.upload-status.is-success {
  color: var(--success);
}

.upload-status.is-error {
  color: var(--danger);
}

.preview-card {
  width: min(100%, 900px);
}

.preview-content {
  display: grid;
  min-height: 390px;
  max-height: calc(100vh - 260px);
  padding: 22px;
  place-items: center;
  overflow: auto;
  background:
    linear-gradient(45deg, #f0f2f6 25%, transparent 25%),
    linear-gradient(-45deg, #f0f2f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f2f6 75%),
    linear-gradient(-45deg, transparent 75%, #f0f2f6 75%),
    #f8f9fb;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-content img,
.preview-content video {
  max-width: 100%;
  max-height: calc(100vh - 310px);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(19, 27, 43, 0.16);
}

.preview-content audio {
  width: min(100%, 520px);
}

.generic-preview {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  text-align: center;
}

.generic-preview .icon {
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  color: var(--primary);
}

.generic-preview strong {
  color: var(--ink);
  font-size: 16px;
}

.preview-footer {
  align-items: center;
}

.preview-footer code {
  max-width: 50%;
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(390px, calc(100vw - 44px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  padding: 13px 15px;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 38px rgba(20, 30, 52, 0.18);
  animation: toast-in 180ms ease-out;
}

.toast .icon {
  margin-top: 2px;
  color: var(--success);
}

.toast.is-error .icon {
  color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1050px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-shell {
    grid-template-columns: minmax(330px, 0.85fr) minmax(400px, 1.15fr);
  }

  .login-brand {
    padding: 55px;
  }

  .login-brand h1 {
    font-size: 44px;
  }
}

@media (max-width: 760px) {
  .login-shell {
    display: block;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 24px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .mobile-brand {
    display: flex;
    margin-bottom: 5px;
  }

  .page-shell {
    width: min(100% - 24px, 1460px);
    padding: 30px 0 50px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading h1 {
    font-size: 29px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card {
    min-height: 94px;
    padding: 15px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
  }

  .stat-card strong {
    font-size: 19px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box,
  .select-box select {
    width: 100%;
  }

  .folder-grid {
    grid-template-columns: 1fr;
  }

  .batch-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-toolbar > div {
    width: 100%;
  }

  .batch-toolbar .button {
    flex: 1;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .modal-footer,
  .preview-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-footer > div,
  .preview-footer > div {
    width: 100%;
  }

  .modal-footer .button,
  .preview-footer .button {
    flex: 1;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .user-create-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .user-create-footer .button {
    width: 100%;
  }

  .preview-footer code {
    max-width: 100%;
  }
}

@media (max-width: 470px) {
  .topbar {
    padding: 0 14px;
  }

  .user-chip {
    display: none;
  }

  .page-heading {
    flex-direction: column;
  }

  .page-heading .button {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 190px;
    margin: 16px;
    padding: 24px 16px;
  }

  .upload-queue {
    margin-right: 16px;
    margin-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
