:root {
  color-scheme: light;
  --bg: #eef1f5;
  --sidebar: #101820;
  --sidebar-soft: #18232d;
  --surface: #ffffff;
  --surface-subtle: #f7f9fb;
  --border: #d9e0e8;
  --border-strong: #c5ced8;
  --text: #111827;
  --muted: #667085;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e7f4f2;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --focus: #2563eb;
  --shadow: 0 18px 40px rgb(16 24 32 / 10%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  background: var(--sidebar);
  color: #f8fafc;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #d7fbef;
  color: #064e3b;
  font-weight: 800;
}

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

.brand strong {
  font-size: 15px;
}

.brand span,
.sidebar-footer span {
  color: #aebdcc;
  font-size: 12px;
}

.nav {
  display: grid;
  align-content: start;
  gap: 4px;
}

.nav-item,
.ghost-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border-radius: 6px;
  color: #d8e2ec;
  text-decoration: none;
  padding: 0 10px;
}

.nav-item svg,
.ghost-button svg {
  width: 17px;
  height: 17px;
}

.nav-item.active,
.nav-item:hover,
.ghost-button:hover {
  background: var(--sidebar-soft);
  color: #fff;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.ghost-button {
  width: 100%;
  border: 0;
  background: transparent;
  justify-content: flex-start;
}

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

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.12;
  font-weight: 760;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 720;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: start center;
  padding-top: 80px;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-form,
.upload-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 14%);
}

.primary-button,
.secondary-button,
.icon-button,
.text-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  padding: 0 15px;
  font-weight: 720;
}

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

.secondary-button,
.text-button,
.icon-button {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.secondary-button,
.text-button {
  padding: 0 12px;
}

.icon-button {
  width: 40px;
}

.primary-button svg,
.secondary-button svg,
.text-button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.secondary-button:hover,
.text-button:hover,
.icon-button:hover {
  background: var(--surface-subtle);
}

.dashboard {
  display: grid;
  gap: 16px;
}

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

.stat,
.drive-strip,
.upload-console,
.video-console {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.stat {
  padding: 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.drive-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.drive-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.drive-icon svg {
  width: 20px;
  height: 20px;
}

.drive-strip p,
.timestamp,
.section-title span {
  color: var(--muted);
}

.timestamp,
.section-title span {
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.upload-console,
.video-console {
  min-width: 0;
}

.upload-console {
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.file-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker > span {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed #a9b4c1;
  border-radius: 8px;
  background: var(--surface-subtle);
  padding: 14px;
  color: var(--text);
}

.file-picker svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex: 0 0 auto;
}

.file-picker strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 0;
}

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

.search-box {
  position: relative;
  min-width: 220px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 32px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface-subtle);
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 720;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

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

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

th {
  color: var(--muted);
  background: #fbfcfe;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfcfe;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.name-cell {
  max-width: 260px;
  font-weight: 700;
}

.desc-cell {
  max-width: 320px;
  color: var(--muted);
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-uploaded {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #abefc6;
}

.status-failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #fecdca;
}

.status-queued,
.status-uploading {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #fedf89;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100vw - 36px));
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  box-shadow: 0 16px 36px rgb(17 24 39 / 24%);
}

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
  }

  .nav {
    grid-column: 1 / -1;
    grid-auto-flow: column;
    overflow: auto;
  }

  .sidebar-footer {
    justify-items: end;
  }

  .content-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

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

  .toolbar,
  .table-tools,
  .table-controls,
  .drive-strip {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  .search-box {
    min-width: 0;
  }

  .segmented {
    grid-auto-flow: row;
  }

  .segmented button {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .segmented button:last-child {
    border-bottom: 0;
  }
}
