:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --text: #161a20;
  --muted: #68717d;
  --muted-2: #8e97a3;
  --line: #dde2e8;
  --line-strong: #cbd2da;
  --accent: #2457d6;
  --accent-hover: #1946b8;
  --accent-soft: #edf3ff;
  --success: #247a4b;
  --success-soft: #e9f6ef;
  --warning: #8a5a00;
  --warning-soft: #fff6df;
  --danger: #b83a3a;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --page-width: 1180px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(36, 87, 214, .055), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { border: 0; }
svg { display: block; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(221, 226, 232, .92);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(16px);
}

.topbar-inner,
.page,
.footer-inner {
  width: min(calc(100% - 32px), var(--page-width));
  margin: 0 auto;
}

.topbar-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #2457d6, #173d99);
  box-shadow: 0 8px 20px rgba(36, 87, 214, .2);
}

.brand-mark svg { width: 18px; height: 18px; }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  background: var(--surface-3);
}

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

.page { padding: 50px 0 72px; }

.hero {
  max-width: 730px;
  margin: 0 auto 26px;
  text-align: center;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.hero p,
.page-heading p {
  margin: 13px auto 0;
  max-width: 650px;
  color: var(--muted);
  font-size: 16px;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1 { font-size: 34px; }
.page-heading p { margin-left: 0; font-size: 15px; }

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

.panel-header {
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.02em;
}

.panel-header-copy {
  min-width: 0;
}

.panel-header-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body { padding: 22px; }

.upload-card,
.request-builder {
  max-width: 820px;
  margin: 0 auto;
}

.dropzone {
  position: relative;
  min-height: 310px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfcfe, #f7f9fb);
  display: grid;
  place-items: center;
  padding: 38px 24px;
  text-align: center;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
  cursor: pointer;
}

.dropzone.compact {
  min-height: 250px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #7e9ce7;
  background: var(--accent-soft);
}

.dropzone.dragover { transform: translateY(-1px); }

.dropzone-icon {
  width: 60px;
  height: 60px;
  border-radius: 17px;
  margin: 0 auto 17px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon svg { width: 29px; height: 29px; }

.dropzone h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.03em;
}

.dropzone p {
  margin: 6px 0 17px;
  color: var(--muted);
}

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

.button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}

.button:hover {
  background: var(--surface-2);
  border-color: #b9c1cb;
}

.button:active { transform: translateY(1px); }

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

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

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

.button.danger { color: var(--danger); }
.button svg { width: 17px; height: 17px; }

.selection {
  display: none;
  margin-top: 14px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
}

.selection.visible { display: block; }

.selection-summary {
  padding: 9px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.selection-summary strong { font-size: 13px; }
.selection-summary span { color: var(--muted); font-size: 12px; }

.file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

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

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

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

.file-meta { min-width: 0; }

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.file-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.settings-grid {
  margin-top: 17px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.field label {
  display: block;
  margin-bottom: 6px;
  color: #4f5965;
  font-size: 12px;
  font-weight: 750;
}

.field-hint {
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 11px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  color: var(--text);
  background: var(--surface);
}

.input,
.select {
  height: 42px;
  padding: 0 11px;
}

.textarea {
  min-height: 94px;
  padding: 10px 11px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #7291df;
  box-shadow: 0 0 0 3px rgba(36, 87, 214, .1);
}

.action-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.helper {
  color: var(--muted);
  font-size: 12px;
}

.step-strip {
  max-width: 820px;
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.step {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.62);
}

.step-number {
  width: 23px;
  height: 23px;
  margin-bottom: 8px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 850;
}

.step strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.step span {
  color: var(--muted);
  font-size: 12px;
}

.share-shell,
.public-request {
  max-width: 720px;
  margin: 0 auto;
}

.public-context {
  margin-bottom: 13px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.share-card { overflow: hidden; }

.share-top {
  padding: 30px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.share-top .file-icon {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  margin: 0 auto 17px;
}

.share-top .file-icon svg { width: 30px; height: 30px; }

.share-top h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}

.share-top p {
  margin: 7px 0 0;
  color: var(--muted);
}

.share-details { padding: 22px 26px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.detail {
  padding: 15px;
  background: var(--surface-2);
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.detail strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.hash-block {
  margin-top: 14px;
}

.hash-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.hash-box {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: #536071;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.share-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #566275;
  background: #f4f7fb;
  font-size: 12px;
}

.request-owner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #1d2633;
  font-weight: 800;
}

.request-owner strong { display: block; }
.request-owner span { color: var(--muted); font-size: 13px; }

.request-message {
  margin-bottom: 16px;
  padding: 13px 14px;
  border-left: 3px solid #b8c8ee;
  border-radius: 0 9px 9px 0;
  color: #4f5965;
  background: #f6f8fc;
  font-size: 13px;
}

.preview-link {
  margin-top: 17px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
}

.preview-link-code {
  min-width: 0;
  color: #536071;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

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

.stat-card { padding: 18px; }

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 3px;
  font-size: 25px;
  letter-spacing: -.035em;
}

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

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

.search {
  position: relative;
  width: min(330px, 100%);
}

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

.search .input { padding-left: 35px; }

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

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

.file-table th,
.file-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.file-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--surface-2);
}

.file-table tr:last-child td { border-bottom: 0; }
.file-table td:first-child { width: 100%; }

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

.table-file .file-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.table-file .file-name { max-width: 430px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.badge.available {
  color: var(--success);
  background: var(--success-soft);
}

.badge.expiring {
  color: var(--warning);
  background: var(--warning-soft);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

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

.icon-button svg { width: 17px; height: 17px; }

.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
}

.tab {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: transparent;
}

.tab.active {
  color: var(--text);
  background: var(--surface-3);
}

.footer {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.55);
}

.footer-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}

.footer-note {
  color: var(--muted-2);
}

@media (max-width: 840px) {
  .nav { display: none; }

  .settings-grid,
  .step-strip,
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  .topbar-inner,
  .page,
  .footer-inner {
    width: min(calc(100% - 22px), var(--page-width));
  }

  .page { padding-top: 34px; }

  .hero { margin-bottom: 20px; }
  .hero h1 { font-size: 34px; }
  .hero p { font-size: 15px; }

  .top-actions .button.ghost { display: none; }

  .panel-body,
  .panel-header,
  .share-details {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dropzone { min-height: 275px; }

  .settings-grid,
  .settings-grid.two,
  .step-strip,
  .stats {
    grid-template-columns: 1fr;
  }

  .action-row,
  .toolbar,
  .footer-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .search { width: 100%; }

  .action-row .button,
  .toolbar .button,
  .share-actions .button {
    width: 100%;
  }

  .share-actions { grid-template-columns: 1fr; }

  .share-top { padding: 24px 18px; }

  .preview-link {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-inner { padding: 17px 0; }
}

/* Backend-connected states */
.form-error {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #efc8c8;
  border-radius: 9px;
  color: #922f2f;
  background: #fff5f5;
  font-size: 13px;
}

.error-notice {
  color: #922f2f;
  background: #fff5f5;
}

.password-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.password-panel .button {
  margin-top: 12px;
}

.share-file-list {
  margin-top: 16px;
  padding: 2px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.checksum-mini {
  color: var(--muted-2);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.upload-success {
  min-height: 220px;
  display: grid;
  place-content: center;
  text-align: center;
}

.upload-success strong {
  font-size: 22px;
  letter-spacing: -.03em;
}

.upload-success span {
  margin-top: 5px;
  color: var(--muted);
}

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

.icon-button.danger {
  color: var(--danger);
}

.empty-cell {
  padding: 32px !important;
  color: var(--muted);
  text-align: center !important;
}

.request-file-subrow td {
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
}

.request-file-subrow td:first-child {
  padding-left: 64px;
}


.result-card {
  max-width: 820px;
  margin: 18px auto 0;
}

.result-card[hidden] {
  display: none;
}

.result-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
}

.result-url {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.result-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.result-new {
  margin-top: 14px;
}

@media (max-width: 700px) {
  .result-link {
    grid-template-columns: 1fr;
  }
}

/* Complete-pass states and owner access */
.field-spaced {
  margin-top: 14px;
}

.logout-form {
  margin: 0;
}

.button:disabled,
.input:disabled,
.select:disabled,
.textarea:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.form-complete {
  opacity: .78;
}

.dropzone:focus-visible {
  outline: 3px solid rgba(36, 87, 214, .18);
  outline-offset: 3px;
  border-color: #7291df;
}

.auth-page {
  display: grid;
  place-items: start center;
}

.auth-card {
  width: min(100%, 430px);
  margin-top: 36px;
}

.auth-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.compact-title {
  margin: 0;
  font-size: 25px;
  line-height: 1.12;
  letter-spacing: -.035em;
}

.muted-copy {
  margin: 10px 0 0;
  color: var(--muted);
}

.muted-copy code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.error-card {
  text-align: center;
}

.error-code {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
}

.upload-success .button {
  margin: 16px auto 0;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 190px;
  max-width: 360px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: #efc8c8;
  color: #922f2f;
  background: #fff8f8;
}

@media (max-width: 620px) {
  .auth-card {
    margin-top: 8px;
  }

  .auth-actions .button {
    width: 100%;
  }

  .toast-host {
    right: 11px;
    bottom: 11px;
    left: 11px;
  }

  .toast {
    max-width: none;
  }
}

.full-width {
  width: 100%;
}

.share-actions > form {
  margin: 0;
}

/* Keep wide dashboard tables contained on narrow screens. */
.dashboard-grid,
.dashboard-grid > *,
.panel,
.table-wrap {
  min-width: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
}

.top-actions:empty {
  display: none;
}

@media (max-width: 840px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 9px 0 8px;
  }

  .nav {
    order: 3;
    width: 100%;
    display: flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
  }

  .nav a {
    flex: 1 1 0;
    padding: 7px 8px;
    text-align: center;
    white-space: nowrap;
  }
}

.request-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
