:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #111827;
  --line: #d6deea;
  --line-strong: #b8c3d4;
  --text: #111827;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --teal: #0f766e;
  --green: #16a34a;
  --amber: #b45309;
  --danger: #b42318;
  --danger-bg: #fff1f2;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 360px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button,
input,
a {
  font: inherit;
}

button,
.upload-button,
.text-action,
.danger-action {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
.upload-button:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(180deg, #dbe7f5 0, #eef2f6 320px),
    var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #0f172a;
  color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
}

.brand strong,
.brand span,
.login-brand strong,
.login-brand span {
  display: block;
}

.brand span,
.login-brand span {
  margin-top: 4px;
  color: #aab4c2;
  font-size: 12px;
}

.sidebar-status {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.72);
}

.sidebar-status span {
  display: block;
  color: #94a3b8;
  font-size: 12px;
}

.sidebar-status strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.category-form {
  display: grid;
  gap: 8px;
}

.category-form label,
.search-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sidebar .category-form label {
  color: #cbd5e1;
}

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

.inline-form input,
.search-field input,
.login-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
}

.inline-form input {
  border-color: rgba(148, 163, 184, 0.36);
  background: #111827;
  color: #f8fafc;
}

.inline-form button,
.secondary-button,
.upload-button,
.primary-action,
.logout-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 15px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.inline-form button:hover,
.upload-button:hover,
.primary-action:hover {
  background: var(--primary-dark);
}

.logout-button {
  margin-top: auto;
  width: 100%;
  background: transparent;
  border-color: rgba(148, 163, 184, 0.35);
  color: #dbe4ef;
}

.logout-button:hover {
  border-color: #ffffff;
  color: #ffffff;
}

.category-list {
  display: grid;
  gap: 7px;
  overflow-y: auto;
  padding-right: 2px;
}

.category-item {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: #d5dce7;
  text-align: left;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.category-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-item small {
  color: #94a3b8;
}

.category-item:hover,
.category-item.active {
  background: #1f2937;
  border-color: rgba(148, 163, 184, 0.22);
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.hero-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  padding: 24px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}

.hero-panel h1,
.login-copy h1 {
  margin: 12px 0 0;
  font-size: 30px;
  line-height: 1.18;
}

.hero-panel p,
.login-copy p {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.toolbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.search-field {
  display: grid;
  gap: 6px;
  width: min(320px, 34vw);
}

.upload-button {
  display: inline-grid;
  place-items: center;
  position: relative;
  background: var(--green);
}

.upload-button:hover {
  background: #15803d;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.system-alert {
  margin-bottom: 18px;
  border: 1px solid #f0b429;
  border-radius: 8px;
  background: #fffbeb;
  color: #713f12;
  padding: 12px 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 26px;
  line-height: 1;
}

.metric-card.accent {
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf5;
  color: #064e3b;
}

.file-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.file-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.file-panel-head h2 {
  margin: 0;
  font-size: 19px;
}

.file-panel-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.secondary-button {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

tbody tr {
  transition: background-color 180ms ease;
}

tbody tr:hover {
  background: #f8fafc;
}

.file-name {
  display: block;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-action,
.danger-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 11px;
  text-decoration: none;
  font-weight: 700;
}

.text-action {
  background: #eaf2ff;
  color: var(--primary);
}

.danger-action {
  border: 1px solid #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state {
  padding: 64px 16px;
  color: var(--muted);
  text-align: center;
}

.upload-drawer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(460px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
}

.upload-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.upload-drawer strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 9px;
  margin-top: 12px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.upload-drawer p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, #dbe7f5 0, #eef2f6 48%),
    #eef2f6;
}

.login-panel {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.16);
}

.login-copy {
  margin-top: 28px;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.login-form label {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  margin-top: 8px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .hero-panel,
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field {
    width: 100%;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
