:root {
  --ink: #17222b;
  --muted: #667780;
  --line: #d7e0df;
  --paper: #f6f8f5;
  --surface: #ffffff;
  --teal: #147c77;
  --teal-dark: #0f5f5b;
  --coral: #d95d45;
  --success: #176b45;
  --danger: #a63632;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(20, 124, 119, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 124, 119, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; letter-spacing: 0; }

a { color: var(--teal-dark); }

.auth-body, .files-body { min-height: 100vh; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-panel {
  width: min(100%, 420px);
  border-top: 4px solid var(--teal);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(23, 34, 43, 0.12);
  padding: 2.25rem;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: white;
  font-family: Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.eyebrow {
  margin: 1.5rem 0 0.45rem;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-weight: 600; }
.auth-copy { color: var(--muted); line-height: 1.55; }

.auth-form { display: grid; gap: 0.65rem; margin-top: 1.5rem; }
.auth-form label { margin-top: 0.45rem; font-size: 0.83rem; font-weight: 700; }

input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9c7c6;
  border-radius: 4px;
  background: white;
  color: var(--ink);
  padding: 0.65rem 0.75rem;
}

input:focus { outline: 3px solid rgba(20, 124, 119, 0.16); border-color: var(--teal); }

.code-input { font-size: 1.45rem; text-align: center; font-variant-numeric: tabular-nums; }

.primary-button, .secondary-button, .file-picker {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  font-weight: 750;
  text-decoration: none;
}

.primary-button { background: var(--teal); color: white; }
.primary-button:hover { background: var(--teal-dark); }
.secondary-button, .file-picker { border: 1px solid #adc0be; background: white; color: var(--teal-dark); }
.secondary-button:hover, .file-picker:hover { background: #edf5f3; }
.auth-form .primary-button { margin-top: 0.8rem; width: 100%; }
.quiet-link { display: inline-block; margin-top: 1.25rem; font-size: 0.85rem; }

.notice { border-left: 4px solid; padding: 0.75rem 0.9rem; font-size: 0.88rem; }
.notice-error { border-color: var(--danger); background: #fff0ee; color: #762724; }
.notice-success { border-color: var(--success); background: #eaf7ef; color: #125237; }

.files-body { display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  flex: 0 0 64px;
  background: #102d30;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
}

.wordmark { color: white; text-decoration: none; font-family: Georgia, serif; font-size: 1.25rem; }
.wordmark span { color: #7fd3ca; }
.account-actions { display: flex; align-items: center; gap: 0.8rem; }
.username { color: #c8dcda; font-size: 0.85rem; }
.account-actions form { margin: 0; }

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid #496568;
  border-radius: 4px;
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 1.15rem;
}

.workspace { width: min(1180px, 92vw); flex: 1; margin: 0 auto; padding: 2.4rem 0 4rem; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.workspace-heading .eyebrow { margin-top: 0; }
.privacy-label { color: var(--muted); font-size: 0.8rem; }

.command-bar {
  margin-top: 1.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.upload-form, .folder-form { display: flex; align-items: center; gap: 0.6rem; }
.upload-form input[type="file"] { max-width: 280px; color: var(--muted); }
.file-picker { display: none; }
.folder-form input { width: 180px; }
.compact { min-width: 90px; }

.pathbar { min-height: 50px; display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.86rem; }

.file-list { border: 1px solid var(--line); background: var(--surface); }
.file-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 100px 160px 90px;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #e8eded;
  padding: 0.7rem 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.file-row:last-child { border-bottom: 0; }
.file-header { min-height: 42px; background: #eef3f1; color: #49605f; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.folder-row:hover, .file-row:not(.file-header):hover { background: #f7fbfa; }
.file-name { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.file-icon { width: 22px; display: inline-block; color: #80918f; }
.folder-icon { color: var(--coral); }
.download-link { font-weight: 700; }

.empty-state { min-height: 210px; display: grid; place-content: center; gap: 0.4rem; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); }
.portal-footer { padding: 1.2rem 4vw; background: #e6eeeb; color: #667875; text-align: center; font-size: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 760px) {
  .auth-panel { padding: 1.6rem; }
  .workspace { width: min(94vw, 600px); padding-top: 1.5rem; }
  .workspace-heading { align-items: start; flex-direction: column; }
  .command-bar, .upload-form, .folder-form { align-items: stretch; flex-direction: column; }
  .upload-form input[type="file"], .folder-form input { max-width: none; width: 100%; }
  .file-header { display: none; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem 1rem; }
  .file-row > :nth-child(3) { grid-column: 1; font-size: 0.75rem; }
  .file-row > :nth-child(4) { grid-column: 2; grid-row: 1 / span 2; }
}