/* Shrijeeth Cloud: the category-standard file manager. Tokens first, then layout, then components. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --rail: #eef1f5;
  --hover: #edf0f4;
  --selected: #e1ebfd;
  --line: #e2e5ea;
  --line-strong: #cdd2da;
  --text: #1b1e23;
  --text-2: #5a616c;
  --text-3: #626974;
  --accent: #1a5fd6;
  --accent-fill: #1a5fd6;
  --accent-fill-hover: #164fb4;
  --on-accent: #ffffff;
  --accent-soft: #e1ebfd;
  --danger: #c4302b;
  --danger-soft: #fdecea;
  --danger-text: #ffffff;
  --success: #1e7b45;
  --success-soft: #e3f4ea;
  --warning: #9a5b00;
  --focus: #1a5fd6;
  --shadow-1: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-2: 0 4px 12px rgb(16 24 40 / 10%), 0 2px 4px rgb(16 24 40 / 6%);
  --radius: 8px;
  --radius-lg: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --topbar: 60px;
  --rail-w: 232px;
  color-scheme: light;
}

/* theme.js sets data-theme from the saved choice, or from the system setting when it is "system". */
:root[data-theme="dark"] {
    --bg: #16181c;
    --surface: #1d2025;
    --rail: #1a1c20;
    --hover: #262a31;
    --selected: #1f3357;
    --line: #2c3038;
    --line-strong: #3a3f49;
    --text: #e8eaed;
    --text-2: #a9afb8;
    --text-3: #959ba5;
    --accent: #6ea2ff;
    --accent-fill: #2563eb;
    --accent-fill-hover: #1f55c9;
    --on-accent: #ffffff;
    --accent-soft: #1f3357;
    --danger: #ff7b72;
    --danger-soft: #3a1f1e;
    --danger-text: #2b0b09;
    --success: #5cd08c;
    --success-soft: #16301f;
    --warning: #f0b45b;
    --focus: #8db6ff;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 6px 18px rgb(0 0 0 / 45%), 0 2px 6px rgb(0 0 0 / 30%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
* { scrollbar-color: var(--line-strong) transparent; }

/* Icons: authored SVG injected into [data-icon] */
[data-icon] { display: inline-flex; width: 20px; height: 20px; flex: none; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------- Buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn [data-icon] { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-text); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-icon { width: 36px; padding: 0; }
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3) transparent var(--text-3) transparent;
  animation: spin 700ms linear infinite;
}
.btn-primary.is-busy::after { border-color: var(--on-accent) transparent var(--on-accent) transparent; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--hover); }
  .btn-primary:hover:not(:disabled) { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
  .btn-danger:hover:not(:disabled) { filter: brightness(0.94); background: var(--danger); }
}

.field { display: grid; gap: 8px; align-content: start; }
.field label { font-weight: 500; font-size: 13px; }
.field .hint { color: var(--text-3); font-size: 12px; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface);
}
.textarea { min-height: 84px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.form-error { color: var(--danger); font-size: 13px; margin: 0; }

/* ---------- Sign in ---------- */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.signin-panel {
  width: min(400px, 100%); padding: 40px 32px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
}
.signin-lead { color: var(--text-2); margin: 12px 0 28px; }
.signin-note { color: var(--text-3); font-size: 12px; margin: 20px 0 0; }
.signin-error {
  margin: 16px 0 0; padding: 10px 12px; border-radius: var(--radius);
  background: var(--danger-soft); color: var(--danger); font-size: 13px; text-align: left;
}
.btn-google { width: 100%; min-height: 44px; font-size: 15px; }
.google-g { width: 18px; height: 18px; display: inline-flex; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; text-decoration: none; }
.brand-large { font-size: 22px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 25%; background: var(--accent-fill);
  display: inline-grid; flex: none; position: relative;
}
/* The S monogram from /logo.svg, masked so it follows the theme tokens. */
.brand-mark::after {
  content: ""; background: var(--on-accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M21.5 10.6C20.3 8.9 18.3 8 16 8c-3.1 0-5.4 1.8-5.4 4.2 0 2.7 2.7 3.5 5.4 4.1 2.8.6 5.5 1.4 5.5 4.2 0 2.4-2.3 4.3-5.5 4.3-2.5 0-4.5-1-5.7-2.8' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.brand-large .brand-mark { width: 40px; height: 40px; }

/* ---------- Shell ---------- */
.shell {
  min-height: 100dvh;
  display: grid;
  grid-template: "top top" var(--topbar) "rail main" 1fr / var(--rail-w) minmax(0, 1fr);
}
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px;
  background: var(--bg);
}
.topbar .brand { width: calc(var(--rail-w) - 36px); flex: none; }
.search { position: relative; flex: 1; max-width: 720px; }
.search input {
  width: 100%; height: 42px; padding: 0 16px 0 44px; border: 1px solid transparent; border-radius: 21px;
  background: var(--rail); transition: background-color 150ms ease, box-shadow 150ms ease;
}
.search input:focus { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); outline: none; }
.search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.search-icon { position: absolute; left: 14px; top: 11px; color: var(--text-3); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.account { position: relative; margin-left: auto; }
.account-button { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-fill); color: var(--on-accent); font-weight: 600; font-size: 14px;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  transform-origin: top right; transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
}
@starting-style { .menu { opacity: 0; transform: scale(0.96); } }
.menu-header { display: grid; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-email { font-weight: 500; word-break: break-all; }
.menu-role { color: var(--text-3); font-size: 12px; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 0 6px 8px; border-radius: 10px; background: var(--rail); }
.theme-switch button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2); font-size: 12px; cursor: pointer; transition: background-color 150ms ease;
}
.theme-switch button [data-icon] { width: 18px; height: 18px; }
.theme-switch button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.theme-switch button:hover:not([aria-checked="true"]) { background: var(--hover); }
.menu-label { padding: 4px 12px 6px; font-size: 12px; color: var(--text-3); }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }

.rail { grid-area: rail; padding: 12px 12px 24px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: var(--topbar); align-self: start; }
.rail-link {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; border-radius: 20px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.rail-link [data-icon] { color: var(--text-2); }
.rail-link:hover { background: var(--hover); }
.rail-link[aria-current="page"] { background: var(--selected); color: var(--text); }
.rail-link[aria-current="page"] [data-icon] { color: var(--accent); }

.content {
  grid-area: main; min-width: 0; margin: 12px 16px 16px 0; padding: 32px 40px 56px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  outline: none;
}

/* ---------- Page header ---------- */
.content > * { max-width: 1120px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; min-height: 40px; }
.page-head h1 { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }
.page-sub { color: var(--text-2); margin: -12px 0 28px; max-width: 72ch; }

.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 20px; }
.crumbs li { display: flex; align-items: center; gap: 2px; min-width: 0; }
.crumbs a, .crumbs span.current {
  padding: 4px 8px; border-radius: 6px; color: var(--text-2); text-decoration: none;
  max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumbs a:hover { background: var(--hover); color: var(--text); }
.crumbs span.current { color: var(--text); }
.crumbs .sep { color: var(--text-3); width: 18px; height: 18px; }

/* ---------- File table ---------- */
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--text-2);
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.table td { padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 120ms ease; }
.table tbody tr:hover { background: var(--hover); }
.col-size { width: 120px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.col-role { width: 188px; }
.col-actions { width: 132px; text-align: right; }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.name-cell a, .name-cell .name {
  color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.name-cell a:hover { text-decoration: underline; }
.name-cell .sub { display: block; color: var(--text-3); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-text { min-width: 0; }
.kind-icon { color: var(--text-2); }
.share-note { display: inline-flex; align-items: center; gap: 4px; margin-top: 1px; color: var(--text-3); font-size: 12px; font-weight: 400; }
.share-note [data-icon] { width: 14px; height: 14px; }
.share-banner { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; color: var(--text-2); font-size: 13px; }
.share-banner [data-icon] { width: 16px; height: 16px; color: var(--text-3); }
.name-text { display: flex; flex-direction: column; }
.phone-only { display: none; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; font-weight: 400; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.kind-icon.folder { color: #6f8bb8; }
:root[data-theme="dark"] .kind-icon.folder { color: #8fa9d6; }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }
.row-actions .btn-icon { min-height: 34px; width: 34px; color: var(--text-2); }
.confirm-row { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.confirm-row .btn { min-height: 30px; padding: 0 10px; font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 500; background: var(--rail); color: var(--text-2); white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }

/* Drop target */
.dropzone { position: relative; border-radius: var(--radius); }
.dropzone.is-over::after {
  content: "Drop to upload here"; position: absolute; inset: 0; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  color: var(--accent); font-weight: 600; pointer-events: none;
}

/* ---------- States ---------- */
.skeleton-row td { height: 48px; }
.skeleton {
  display: block; height: 12px; border-radius: 6px; background: var(--hover);
  background: linear-gradient(90deg, var(--hover) 0%, var(--rail) 50%, var(--hover) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.empty { text-align: center; padding: 72px 16px; color: var(--text-2); }
.empty > [data-icon] { width: 44px; height: 44px; color: var(--text-3); margin-bottom: 12px; }
.empty h2 { font-size: 16px; font-weight: 500; color: var(--text); margin: 0 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 46ch; }
.error-box {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--danger-soft); color: var(--danger);
}
.error-box p { margin: 0 0 10px; color: var(--text); }

/* ---------- Search results ---------- */
.results { list-style: none; margin: 0; padding: 0; }
.result { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); align-items: flex-start; }
.result:hover { background: var(--hover); }
.result-body { min-width: 0; flex: 1; }
.result-name { font-weight: 500; color: var(--text); text-decoration: none; word-break: break-word; }
.result-name:hover { text-decoration: underline; }
.result-path { color: var(--text-3); font-size: 12px; margin-top: 1px; word-break: break-all; }
.result-snippet { color: var(--text-2); margin: 6px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.result-snippet mark { background: color-mix(in srgb, var(--warning) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- Panels / forms in admin views ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 32px; background: var(--surface); }
.panel h2 { font-size: 16px; font-weight: 600; margin: 0 0 20px; }
.form-grid { display: grid; gap: 20px 24px; grid-template-columns: 1fr 1.2fr 0.9fr; align-items: start; }
.form-grid.secret { grid-template-columns: 1fr 1fr; }
.form-grid .span-all { grid-column: 1 / -1; }
.group-row th { padding: 0; border-bottom: 1px solid var(--line); background: transparent; }
.group-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 8px 16px 8px 8px;
  border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left;
  cursor: pointer; border-radius: var(--radius);
}
.group-toggle:hover { background: var(--hover); }
.group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.group-toggle [data-icon] { width: 18px; height: 18px; flex: none; color: var(--text-3); }
.group-toggle [data-icon="chevron"] { transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
.group-toggle[aria-expanded="true"] [data-icon="chevron"] { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .group-toggle [data-icon="chevron"] { transition: none; } }
.group-count { color: var(--text-3); font-weight: 400; }
.table tbody tr.group-row:hover { background: transparent; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-actions .btn { min-width: 120px; min-height: 40px; }
.form-actions .form-error { margin-right: auto; }
.textarea::placeholder { font-family: var(--font); font-size: 14px; }
.secret-value {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-all; color: var(--text);
}
.filter { max-width: 360px; margin-bottom: 16px; }
.list-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.list-toolbar .filter { flex: 1; margin-bottom: 0; }
.list-toolbar .btn { margin-left: auto; min-height: 40px; }
.group-head { display: flex; align-items: center; gap: 8px; padding-right: 8px; }
.group-head .group-toggle { flex: 1; min-width: 0; }
.field-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.textarea.mono { font-family: var(--mono); font-size: 13px; }
.field-row input[type="file"]:focus-visible + .btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Uploads tray ---------- */
.uploads {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(380px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  overflow: hidden;
}
.uploads-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 10px 16px; background: var(--rail); font-weight: 500; }
.upload-item { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.upload-name { display: flex; justify-content: space-between; gap: 12px; }
.upload-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { color: var(--text-3); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.upload-status.ok { color: var(--success); }
.upload-status.err { color: var(--danger); white-space: normal; }
.progress { height: 4px; border-radius: 2px; background: var(--hover); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 200ms linear; }
.progress.indeterminate > span { width: 35%; animation: slide 1.1s var(--ease-out) infinite; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 32px));
  padding: 10px 12px 10px 16px; border-radius: var(--radius); background: #24272d; color: #f1f3f5; box-shadow: var(--shadow-2);
  transition: opacity 200ms ease, transform 200ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }
.toast.leaving { opacity: 0; transform: translateY(8px); }
.toast.error { background: #5c1f1c; }
.toast button { border: 0; background: none; color: #a9c7ff; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 4px; }

.waking {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 8px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  color: var(--text-2); font-size: 13px;
}

/* ---------- Motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .skeleton { animation: none; }
  .progress.indeterminate > span { width: 100%; opacity: 0.4; animation: none; transform: none; }
}

/* ---------- Responsive: phone ---------- */
/* ---------- Storage ---------- */
.storage-summary { display: grid; gap: 10px; margin-bottom: 28px; max-width: 560px; }
.summary-line { color: var(--text-2); }
.summary-line strong { color: var(--text); font-weight: 600; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.is-high .meter-fill { background: var(--warning); }
.store-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.store {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 20px 8px 20px 4px; border-bottom: 1px solid var(--line);
}
.store > .store-form { grid-column: 1 / -1; margin: 0; }
.store-order {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600;
}
.store.is-paused .store-order { background: var(--rail); color: var(--text-3); }
.store.is-paused .store-main { opacity: 0.7; }
.store-main { display: grid; gap: 4px; min-width: 0; }
.store-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.store-name { font-weight: 600; }
.store-main .sub { color: var(--text-3); font-size: 13px; overflow-wrap: anywhere; }
.store-usage { display: grid; gap: 6px; margin-top: 6px; max-width: 420px; }
.badge-muted { background: transparent; border: 1px solid var(--line); color: var(--text-3); }
.store-form h2 { margin-bottom: 16px; }
.store-help { margin: 0 0 20px; max-width: 72ch; }
.kind-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.kind-option {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
}
.kind-option:hover:not(:disabled) { background: var(--hover); }
.kind-option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.kind-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kind-option [data-icon] { width: 18px; height: 18px; }
.store-form .form-grid + .form-grid { margin-top: 20px; }

@media (max-width: 760px) {
  .store { grid-template-columns: 28px minmax(0, 1fr); padding-right: 0; }
  .store-actions { grid-column: 2; }
  :root { --topbar: 56px; }
  .shell { grid-template: "top" var(--topbar) "main" 1fr / minmax(0, 1fr); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); }
  .topbar .brand { width: auto; }
  .brand-name { display: none; }
  .search input { height: 40px; }
  .rail {
    grid-area: auto; position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 30; flex-direction: row; justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
  }
  .rail.single { display: none; }
  .shell:has(.rail.single) { padding-bottom: 0; }
  .rail-link { flex-direction: column; gap: 2px; height: 52px; padding: 6px 12px; border-radius: 14px; font-size: 11px; flex: 1; justify-content: center; }
  .rail-link[aria-current="page"] { background: transparent; }
  .rail-link[aria-current="page"] [data-icon] { background: var(--selected); border-radius: 12px; width: 52px; padding: 0 16px; }
  .content { margin: 0; border: 0; border-radius: 0; padding: 20px 16px 32px; }
  .panel { padding: 18px 16px; margin-bottom: 24px; }
  .form-actions { margin-top: 20px; padding-top: 16px; }
  .form-actions .btn { flex: 1; }
  .crumbs { font-size: 17px; }
  .page-actions { margin-left: 0; width: 100%; }
  .page-actions .btn { flex: 1; }
  .page-actions.fab { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); width: auto; margin: 0; z-index: 35; }
  .shell:has(.rail.single) .page-actions.fab { bottom: calc(20px + env(safe-area-inset-bottom)); }
  .page-actions.fab .btn-primary { min-height: 52px; padding: 0 20px; border-radius: 16px; box-shadow: var(--shadow-2); font-size: 15px; }
  .page-actions.fab .folder-upload, .page-actions.fab .zip-download { display: none; }
  .phone-only { display: inline; }
  .content { padding-bottom: 96px; }
  .col-size, .col-role.optional { display: none; }
  .col-actions { width: 96px; }
  .col-role { width: 124px; }
  .name-cell .wrap { white-space: normal; overflow-wrap: anywhere; }
  .grants thead { display: none; }
  .grants tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .grants tr:last-child { border-bottom: 0; }
  .grants td { height: auto; padding: 4px 12px; border-bottom: 0; }
  .grants td.col-role { grid-column: 1 / -1; grid-row: 2; width: auto; padding-left: 44px; }
  .grants td.col-actions { grid-column: 2; grid-row: 1; width: auto; }
  .grants .select { width: auto; min-width: 168px; }
  .table td { height: 56px; }
  .form-grid, .form-grid.secret { grid-template-columns: 1fr; }
  .uploads { right: 8px; left: 8px; width: auto; bottom: calc(144px + env(safe-area-inset-bottom)); }
  .shell:has(.rail.single) ~ .uploads { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .input, .select, .textarea, .search input { font-size: 16px; }
}
