/* Lattice Drive — private cloud workspace decoy
   Deliberately distinct from the AeroDrive Pro site on cool.techstored.life:
   light neutral palette, hairline borders, self-hosted CSS, no CDN, no framework. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --line: #e4e7ec;
  --line-soft: #eef1f4;
  --ink: #16181d;
  --ink-2: #5a616e;
  --ink-3: #8b929e;
  --accent: #2f6f5e;
  --accent-soft: #e8f1ee;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 28px -18px rgba(16, 24, 40, .28);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 40;
  background: var(--ink); color: #fff;
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px;
}
.skip:focus { left: 8px; }

/* ---------- sidebar ---------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.brand-text small { font-size: 11.5px; color: var(--ink-3); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  transition: background .14s ease, color .14s ease;
}
.nav-item svg { flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.nav-item.is-active svg { opacity: 1; }

.pill {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 7px;
}

.quota {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line-soft);
}

.quota-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.quota-value { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.quota-value b { font-weight: 600; color: var(--ink); }

.meter {
  height: 5px;
  background: var(--line-soft);
  border-radius: 20px;
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  width: 42.8%;
  background: var(--accent);
  border-radius: 20px;
  animation: grow 1s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes grow { from { width: 0; } }

.quota-note { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); }
.quota-note a { color: var(--accent); }
.quota-note a:hover { text-decoration: underline; }

/* ---------- shell / topbar ---------- */

.shell {
  margin-left: var(--sidebar-w);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(247, 248, 250, .86);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-3);
  min-width: 0;
}
.crumbs a:hover { color: var(--ink); }
.crumbs strong { color: var(--ink); font-weight: 500; }
.crumbs .sep { color: var(--line); }

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 10px;
  color: var(--ink-3);
  pointer-events: none;
}
.search input {
  width: 210px;
  height: 32px;
  padding: 0 10px 0 31px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .14s ease, box-shadow .14s ease, width .18s ease;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus {
  outline: none;
  border-color: #b9cfc7;
  box-shadow: 0 0 0 3px rgba(47, 111, 94, .10);
}

.segmented {
  display: flex;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.segmented button {
  display: grid;
  place-items: center;
  width: 28px; height: 26px;
  padding: 0;
  color: var(--ink-3);
  background: none;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .1s ease;
}
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2a6153; }

.icon-btn {
  display: none;
  place-items: center;
  width: 32px; height: 32px;
  padding: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ---------- main ---------- */

.main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  padding: 22px 24px 40px;
  margin: 0 auto;
}

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

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-delta { font-size: 11.5px; color: var(--ink-3); }
.stat-delta.is-up { color: var(--accent); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.muted { color: var(--ink-3); font-size: 12px; }

.select select {
  height: 28px;
  padding: 0 24px 0 9px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b929e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>")
    no-repeat right 7px center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  appearance: none;
  cursor: pointer;
}
.select select:focus { outline: none; border-color: #b9cfc7; box-shadow: 0 0 0 3px rgba(47, 111, 94, .10); }

/* ---------- folders ---------- */

.folders {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}

.folder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.folder:hover { background: var(--surface-2); border-color: var(--line); }
.folder:active { background: var(--line-soft); }

.fi {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  flex: none;
}
.fi-folder { background: var(--accent-soft); color: var(--accent); }

.fname {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fmeta { margin-left: auto; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- files table ---------- */

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

.files {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.files th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.files td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.files tbody tr { transition: background .12s ease; }
.files tbody tr:hover { background: var(--surface-2); }
.files tbody tr:last-child td { border-bottom: 0; }

.c-name { display: flex; align-items: center; gap: 10px; }
.nm { font-weight: 500; }
.c-size, .c-mod { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.fi-zip, .fi-pdf, .fi-txt, .fi-tar, .fi-md {
  font: 600 9px/1 var(--mono);
  letter-spacing: .04em;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--line);
}
.fi-zip  { color: #9a6b2f; background: #fdf5e8; border-color: #f2e3c8; }
.fi-pdf  { color: #a4453f; background: #fdf0ef; border-color: #f3dad8; }
.fi-txt  { color: #4b6178; background: #eef2f7; border-color: #dde5ee; }
.fi-tar  { color: #4a6a52; background: #eef5f0; border-color: #dce9e0; }
.fi-md   { color: #5b5578; background: #f1eff8; border-color: #e2ddf0; }

.tag {
  display: inline-block;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
}
.tag.is-keep { color: var(--accent); background: var(--accent-soft); border-color: #d5e5e0; }

/* grid view */

.files.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.is-grid thead { display: none; }
.is-grid tbody { display: contents; }
.is-grid tr {
  display: block;
  margin: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 0;
}
.is-grid td { display: block; border: 0; padding: 2px 12px; white-space: normal; }
.is-grid .c-name { padding: 6px 12px 8px; }
.is-grid .c-size::before { content: "Size  "; color: var(--ink-3); }
.is-grid .c-mod::before { content: "Modified  "; color: var(--ink-3); }

.empty {
  margin: 0;
  padding: 22px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------- mobile ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .32);
  z-index: 18;
  animation: fade .16s ease both;
}
@keyframes fade { from { opacity: 0; } }

@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search input { width: 150px; }
}

@media (max-width: 720px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.16, 1, .3, 1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .shell { margin-left: 0; }
  .icon-btn.menu { display: grid; }
  .topbar { padding: 10px 14px; }
  .main { padding: 16px 14px 32px; }
  .search input { width: 40px; padding-right: 4px; }
  .search input:focus { width: 170px; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 0 9px; }
  .c-mod, .c-tag { display: none; }
  .is-grid .c-mod { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
