/* ---------------------------------------------------------------------------
   Brand colors. These are a spruce-based estimate; swap in Lake One's exact
   hex values here and everything else follows.
   ------------------------------------------------------------------------- */
:root {
  --spruce: #1f3d36;        /* header, primary buttons, sign-in backdrop */
  --spruce-deep: #152b26;   /* hover / pressed */
  --lake: #2d6a80;          /* links and focus */
  --paper: #f3f5f3;         /* page background */
  --surface: #ffffff;       /* table and panels */
  --ink: #1a2422;           /* body text */
  --muted: #5d6c68;         /* secondary text */
  --line: #d6dedb;          /* borders */
  --danger: #a23a2b;
  --success: #2f6b45;

  --radius-sm: 4px;
  --radius-lg: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --lake: #86bccf;
    --paper: #111917;
    --surface: #18221f;
    --ink: #e4ebe8;
    --muted: #9aaaa5;
    --line: #2b3a36;
    --danger: #e08a7c;
    --success: #8cc9a1;
    color-scheme: dark;
  }
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--lake); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--lake); outline-offset: 2px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sprite { display: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }

/* --- Buttons and fields -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 40px; padding: .45rem 1rem;
  font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { color: #fff; background: var(--spruce); border-color: var(--spruce); }
.btn-primary:hover { background: var(--spruce-deep); border-color: var(--spruce-deep); }
.btn-block { width: 100%; }
.btn-on-dark { color: #fff; background: transparent; border-color: rgba(255,255,255,.35); min-height: 34px; }
.btn-on-dark:hover { border-color: #fff; }
.btn-link {
  min-height: 0; padding: .2rem .35rem; border: 0; background: none;
  color: var(--lake); font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: var(--danger); }

.field { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.field input {
  font: inherit; font-weight: 400; font-size: 1rem;
  padding: .6rem .7rem; min-height: 44px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field input:focus-visible { border-color: var(--lake); }
.stack { display: grid; gap: 1rem; }

/* --- Notices ------------------------------------------------------------- */
.notices { display: grid; gap: .5rem; margin: 0 0 1.25rem; }
.notice {
  margin: 0; padding: .65rem .9rem;
  border-left: 4px solid var(--lake); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.notice-error { border-left-color: var(--danger); }
.notice-success { border-left-color: var(--success); }

/* --- Sign-in: a lake depth chart behind the card ------------------------- */
.page-login { background: var(--spruce); }
.login-field {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 1.5rem;
  background: var(--spruce) url("contours.svg") center / cover no-repeat;
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 2rem 2rem 1.75rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(8, 20, 17, .45);
}
.login-logo { display: block; height: 44px; width: auto; margin: 0 0 1.75rem; }
.login-card h1 { margin: 0 0 .25rem; font-size: 1.6rem; line-height: 1.2; letter-spacing: -.01em; }
.lede { margin: 0 0 1.5rem; color: var(--muted); }
.help { margin: 1.25rem 0 0; font-size: .9rem; color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .login-logo { background: #fff; padding: 6px 10px; border-radius: var(--radius-sm); height: 56px; }
}

/* --- File browser -------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem clamp(1rem, 4vw, 2rem);
  color: #fff; background: var(--spruce);
}
.topbar-brand { display: flex; }
.topbar-brand img { height: 30px; width: auto; display: block; }
.topbar-product {
  padding-left: 1rem; border-left: 1px solid rgba(255,255,255,.3);
  font-weight: 600; opacity: .9;
}
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.topbar-user form { margin: 0; }
.topbar-name { opacity: .85; font-size: .95rem; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem; }

.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 1.25rem; padding: 0; font-size: 1.15rem; }
.crumbs li + li::before { content: "/"; margin: 0 .5rem; color: var(--muted); }
.crumbs [aria-current] { font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.dropzone {
  flex: 1 1 420px;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding: 1rem 1.1rem;
  border: 2px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color .15s, background-color .15s;
}
.dropzone.is-over { border-color: var(--lake); background: color-mix(in srgb, var(--lake) 8%, var(--surface)); }
.dropzone.is-busy { border-style: solid; }
.dropzone-hint { color: var(--muted); font-size: .92rem; }
.file-pick { position: relative; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-pick:focus-within { outline: 3px solid var(--lake); outline-offset: 2px; }
.upload-status { flex-basis: 100%; display: grid; gap: .35rem; font-size: .92rem; }
.upload-status progress { width: 100%; height: 8px; accent-color: var(--spruce); }

.new-folder { flex: 0 0 auto; }
.new-folder summary { list-style: none; }
.new-folder summary::-webkit-details-marker { display: none; }
.new-folder[open] summary { margin-bottom: .75rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.listing { width: 100%; border-collapse: collapse; }
.listing th {
  text-align: left; font-size: .85rem; font-weight: 600; color: var(--muted);
  padding: .7rem 1rem; border-bottom: 1px solid var(--line);
}
.listing td { padding: .6rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.listing tbody tr:last-child td { border-bottom: 0; }
.listing tbody tr:hover { background: color-mix(in srgb, var(--lake) 5%, var(--surface)); }
.listing .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.listing .name { min-width: 14rem; word-break: break-word; }
.name-cell { display: flex; align-items: center; gap: .6rem; }
.listing .name a { color: var(--ink); font-weight: 500; text-decoration: none; }
.listing .name a:hover { color: var(--lake); text-decoration: underline; }
.col-modified { white-space: nowrap; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; margin: 0; }

.icon { width: 20px; height: 20px; flex: none; }
.icon-folder { fill: var(--spruce); }
.icon-file { stroke: var(--muted); stroke-width: 1.4; }
@media (prefers-color-scheme: dark) { .icon-folder { fill: var(--lake); } }

.empty {
  padding: 3rem 1.5rem; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  color: var(--muted);
}
.empty p { margin: 0; }
.empty-title { color: var(--ink); font-weight: 600; font-size: 1.1rem; margin-bottom: .35rem !important; }

.foot { max-width: 1040px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem) 2rem; color: var(--muted); font-size: .9rem; }

@media (max-width: 640px) {
  .topbar-product, .topbar-name, .col-modified { display: none; }
  .listing .name { min-width: 0; }
  .listing th, .listing td { padding-left: .75rem; padding-right: .75rem; }
  .row-actions form { display: block; }
  .row-actions .btn-link { display: block; margin-left: auto; padding: .15rem 0; }
  .dropzone-hint { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --- Sign-in codes ------------------------------------------------------- */
.login-card-wide { max-width: 460px; }
.code-input { font-size: 1.4rem !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.cancel-form { margin: .75rem 0 0; text-align: center; }
.setup-steps { margin: 0; padding: 0 0 0 1.25rem; display: grid; gap: 1.25rem; }
.setup-steps li::marker { font-weight: 700; color: var(--spruce); }
.setup-steps p { margin: 0 0 .6rem; }
.qr { display: block; width: 205px; height: 205px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.manual-key { margin-top: .6rem; font-size: .92rem; }
.manual-key summary { color: var(--lake); cursor: pointer; }
.manual-key .key {
  margin: .4rem 0 0; padding: .5rem .7rem; border-radius: var(--radius-sm);
  background: var(--paper); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem; letter-spacing: .05em; word-spacing: .3em; user-select: all;
}
@media (prefers-color-scheme: dark) { .setup-steps li::marker { color: var(--lake); } }
