/* Foundations: preserve the violet identity with quieter surfaces and readable text. */
:root {
  --ink: #292735;
  --muted: #6b6576;
  --purple: #7860d9;
  --purple-dark: #6550c1;
  --line: #e9e7ef;
  --canvas: #f7f8fb;
  --soft: #f0edfc;
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
button, summary { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
button { color: inherit; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
#page-title:focus { outline: none; }
input, select { border: 1px solid #dcd8e5; border-radius: 9px; background: #fff; color: var(--ink); padding: 11px 13px; min-width: 0; }
input:focus, select:focus { border-color: var(--purple); outline: 2px solid #7860d930; outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.button { border: 1px solid transparent; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 16px; font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s; }
.primary { background: var(--purple); color: white; }
.primary:hover { background: var(--purple-dark); }
.secondary { background: #fff; border-color: #dfdce7; }
.secondary:hover { background: #f8f7fc; border-color: #c8c0df; }
.button svg { width: 18px; height: 18px; }
.wide { width: 100%; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); flex-shrink: 0; }
.icon-button:hover { background: var(--soft); color: var(--purple-dark); }
.icon-button svg { width: 18px; height: 18px; }
.danger, .danger-soft { color: #ad3f51; }
.danger-soft { background: #fff1f2; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 29px; letter-spacing: -1.5px; font-weight: 700; }
.brand svg { width: 33px; height: 33px; color: var(--purple); }
.brand-dot { color: var(--purple); }
.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; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 40; background: #fff; padding: 12px 18px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

/* A stable navigation rail, with secondary tools in one disclosure. */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: 224px; flex: 0 0 224px; display: flex; flex-direction: column; padding: 29px 18px 0; background: #fff; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; }
.sidebar .brand { margin: 0 13px 49px; }
.workspace-label { font-size: 10px; letter-spacing: 1.5px; color: var(--muted); margin: 0 14px 14px; font-weight: 600; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 46px; border-radius: 9px; color: #655f72; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover { background: #f8f7fc; }
.sidebar nav a.active { background: var(--soft); color: var(--purple-dark); font-weight: 600; }
.sidebar nav a svg { width: 20px; height: 20px; }
.sidebar nav a:last-child { margin-top: 17px; }
.sidebar-bottom { margin-top: auto; padding-top: 32px; }
.storage-box { display: flex; gap: 11px; align-items: center; padding: 18px 13px; color: var(--muted); }
.storage-box strong { display: block; font-size: 13px; color: #555061; font-weight: 600; }
.storage-box span { display: block; font-size: 12px; margin-top: 2px; }
.user-panel { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding: 21px 12px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--soft); width: 36px; height: 36px; color: var(--purple-dark); border-radius: 50%; }
.avatar svg { width: 18px; height: 18px; }
.user-panel > div { min-width: 0; }
.user-panel strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.user-panel small { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 3px; }
.user-panel small svg { width: 11px; height: 11px; }
.main { min-width: 0; flex: 1; }
.topbar { height: calc(92px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 40px 0; display: flex; align-items: center; gap: 20px; }
.search { max-width: 580px; width: 100%; background: #eeedf3; border: 1px solid transparent; border-radius: 12px; display: flex; align-items: center; gap: 11px; padding: 0 9px 0 16px; height: 46px; transition: background .15s, border-color .15s; }
.search:focus-within { background: #fff; border-color: var(--purple); box-shadow: 0 0 0 3px #7860d912; }
.search > svg { width: 19px; height: 19px; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 10px 0; outline: none; box-shadow: none; width: 100%; font-size: 14px; }
.search input::placeholder { color: var(--muted); }
.search-shortcut { font-family: inherit; font-size: 11px; white-space: nowrap; color: var(--muted); border: 1px solid #dcd8e5; padding: 1px 5px; border-radius: 4px; }
.search:focus-within .search-shortcut { display: none; }
.utility-menu { position: relative; margin-left: auto; }
.utility-menu > summary { list-style: none; width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; }
.utility-menu > summary::-webkit-details-marker { display: none; }
.utility-menu[open] > summary { color: var(--purple-dark); background: var(--soft); }
.utility-popover { position: absolute; right: 0; top: 50px; width: 260px; z-index: 15; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 40px #29273515; }
.menu-label { display: block; padding: 10px 12px; font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.utility-popover button { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 7px; background: transparent; width: 100%; min-height: 44px; padding: 10px 12px; font-size: 13px; text-align: left; }
.utility-popover button:hover { background: var(--soft); }
.utility-popover svg { width: 18px; height: 18px; color: var(--muted); }
.utility-popover form { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }

/* Workspace hierarchy: title, tools, then the files. */
.content { padding: 27px 40px 30px; max-width: 1560px; margin: auto; }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); margin: -8px 0 18px; flex-wrap: wrap; }
.breadcrumb a { padding: 3px 0; overflow-wrap: anywhere; }
.breadcrumb [aria-current] { color: var(--ink); }
.breadcrumb a:hover { color: var(--purple-dark); text-decoration: underline; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.page-intro { min-width: 0; }
h1 { font-size: 30px; letter-spacing: -.9px; line-height: 1.25; font-weight: 600; margin: 0 0 9px; overflow-wrap: anywhere; }
.page-heading p { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.heading-actions { display: flex; gap: 10px; flex-shrink: 0; }
.file-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin-bottom: 14px; gap: 16px; }
.file-summary, .view-controls { display: flex; align-items: center; gap: 12px; }
.file-summary { min-width: 0; flex-wrap: wrap; }
.file-count { font-size: 13px; color: var(--muted); }
.clear-search { display: flex; align-items: center; gap: 4px; color: var(--purple-dark); font-size: 12px; min-height: 32px; }
.clear-search:hover { text-decoration: underline; }
.clear-search svg { width: 14px; height: 14px; }
.file-toolbar select { font-size: 12px; padding: 8px 27px 8px 11px; min-height: 36px; background: transparent; border-color: var(--line); }
.view-toggle { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.view-toggle .icon-button { width: 32px; height: 30px; border-radius: 6px; padding: 6px; }
.view-toggle [aria-pressed="true"] { background: var(--soft); color: var(--purple-dark); }
.files-surface { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); min-height: 360px; }
.file-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; table-layout: fixed; }
.file-table th { font-size: 11px; font-weight: 500; color: var(--muted); padding: 15px 16px; background: #fcfbfe; border-bottom: 1px solid var(--line); }
.file-table th:first-child { width: 46%; border-top-left-radius: var(--radius); }
.file-table th:last-child { width: 100px; border-top-right-radius: var(--radius); }
.file-table td { border-bottom: 1px solid #f0eef5; padding: 12px 16px; font-size: 12px; color: var(--muted); }
.file-table th:first-child, .file-table td:first-child { padding-left: 22px; }
.file-table tr:last-child td { border-bottom: 0; }
.file-table tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.file-table tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
.file-table tbody tr:hover, .file-table tbody tr:focus-within { background: #f9f7fe; }
.file-name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-details { min-width: 0; flex: 1; }
.file-link { display: block; max-width: 100%; border: 0; padding: 5px 0; background: transparent; color: #3f374d; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; text-align: left; min-width: 0; line-height: 1.5; }
button.file-link, a.file-link { cursor: pointer; }
button.file-link:hover, a.file-link:hover { color: var(--purple-dark); text-decoration: underline; }
.file-mobile-meta { display: none; font-size: 11px; color: var(--muted); }
.file-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 40px; background: #f3f1f6; color: #81758f; border-radius: 9px; flex-shrink: 0; }
.file-icon svg { width: 21px; height: 21px; }
.kind-folder { background: #f8f1e3; color: #b18b43; }
.kind-image { background: #f4ecf7; color: #a06aaf; }
.kind-pdf { background: #faeeee; color: #bf7179; }
.kind-video { background: #f1edfa; color: #9173bf; }
.kind-audio { background: #fcefe8; color: #b77b5b; }
.kind-text { background: #edf2fc; color: #6d87bc; }
.imported-mark { display: flex; color: var(--muted); }
.imported-mark svg { width: 13px; height: 13px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.is-starred { color: #99742c; }
.is-starred svg { fill: #f3e6bc; }

/* One semantic table powers both layouts; controls and focus stay in place. */
.layout-grid .files-surface:has(.file-table) { border: 0; background: transparent; min-height: 0; }
.layout-grid .file-table { display: block; }
.layout-grid .file-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.layout-grid .file-table tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.layout-grid .file-table tr { position: relative; display: grid; grid-template-columns: 1fr auto; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.layout-grid .file-table tbody tr:hover, .layout-grid .file-table tbody tr:focus-within { background: #fbfaff; border-color: #d6ccee; }
.layout-grid .file-table td { border: 0; padding: 0; border-radius: 0; }
.layout-grid .file-table td:first-child { grid-column: 1 / -1; }
.layout-grid .file-name-cell { align-items: flex-start; flex-direction: column; gap: 17px; }
.layout-grid .file-icon { width: 48px; height: 52px; border-radius: 11px; }
.layout-grid .file-icon svg { width: 27px; height: 27px; }
.layout-grid .file-details { width: 100%; }
.layout-grid .file-link { font-weight: 500; }
.layout-grid .date-col { display: none; }
.layout-grid .type-col, .layout-grid .size-col { display: table-cell; margin-top: 5px; font-size: 11px; }
.layout-grid .size-col { text-align: right; }
.layout-grid .actions-cell { position: absolute; right: 12px; top: 15px; }
.layout-grid .imported-mark { position: absolute; top: 80px; right: 22px; }
.layout-grid .file-mobile-meta { display: none; }

.empty-state { min-height: 360px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 55px 24px; }
.empty-icon { height: 68px; width: 68px; display: flex; align-items: center; justify-content: center; background: var(--soft); border-radius: 20px; color: var(--purple); margin-bottom: 24px; }
.empty-icon svg { height: 32px; width: 32px; }
.empty-state h3 { font-size: 18px; font-weight: 500; margin: 0 0 9px; color: #494052; }
.empty-state p { font-size: 13px; line-height: 1.8; color: var(--muted); max-width: 360px; margin: 0; }
.empty-state .button { margin-top: 22px; }
.empty-hint { font-size: 11px; color: var(--muted); margin-top: 18px; }
.content-footer { display: flex; align-items: center; margin-top: 18px; color: var(--muted); font-size: 11px; }
.drop-hint { display: flex; align-items: center; gap: 7px; }
.drop-hint svg { width: 14px; height: 14px; }
.content-footer:empty, .files-surface:has(.empty-state) + .content-footer { display: none; }
.drop-overlay { display: none; }
.dragging .drop-overlay { position: absolute; inset: -1px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 2px dashed var(--purple); border-radius: var(--radius); background: #f5f2ffed; color: var(--purple-dark); pointer-events: none; }
.drop-overlay svg { width: 32px; height: 32px; margin-bottom: 8px; }
.drop-overlay span { font-size: 12px; }

/* Dialogs and feedback share the same spacing and control sizes. */
dialog { width: 520px; max-width: calc(100vw - 32px); max-height: 90vh; max-height: 90dvh; border: 1px solid #e7e1ef; border-radius: 18px; padding: 34px; box-shadow: 0 25px 100px #2b1e4c25; overflow-y: auto; color: var(--ink); }
dialog::backdrop { background: #28213560; backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 12px; top: 12px; }
.modal-heading { margin-bottom: 25px; }
.modal-heading h2 { font-size: 22px; font-weight: 600; letter-spacing: -.4px; margin: 18px 0 8px; overflow-wrap: anywhere; }
.modal-heading p, .muted { font-size: 13px; color: var(--muted); line-height: 1.8; }
.modal-icon { display: flex; width: 46px; height: 46px; align-items: center; justify-content: center; background: var(--soft); color: var(--purple); border-radius: 12px; margin-bottom: 22px; }
.modal-icon svg { width: 24px; height: 24px; }
dialog input, dialog select { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; flex-wrap: wrap; }
.border-top { border-top: 1px solid var(--line); padding-top: 22px; }
.input-row { display: flex; gap: 8px; }
.input-row input, .input-row select { flex: 1; min-width: 0; }
.spaced { margin-top: 22px; }
.preview-dialog { width: 960px; }
.preview-heading { display: flex; align-items: center; gap: 13px; margin: 0 25px 22px 0; }
.preview-heading > div { min-width: 0; }
.preview-heading h2 { font-size: 18px; font-weight: 500; margin: 0 0 6px; overflow-wrap: anywhere; }
.preview-heading p { font-size: 12px; color: var(--muted); margin: 0; }
.preview-body { background: #f7f6fa; border: 1px solid #eae6ef; border-radius: 10px; overflow: hidden; text-align: center; }
.preview-image, .preview-body video { display: block; max-width: 100%; max-height: 65vh; object-fit: contain; margin: auto; }
.preview-body audio { width: 90%; margin: 25px auto; }
.preview-pdf { display: block; width: 100%; height: 65vh; border: 0; background: white; }
.preview-body pre { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 24px; font-size: 13px; line-height: 1.7; max-height: 65vh; overflow: auto; }
.audio-art { padding: 40px; color: #b69a89; }
.audio-art svg { width: 60px; height: 60px; }
.unsupported { padding: 65px 20px; color: var(--muted); }
.unsupported > svg { width: 50px; height: 50px; }
.unsupported h3 { font-size: 16px; font-weight: 500; }
.unsupported p { font-size: 13px; }
.import-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.import-steps li { display: flex; gap: 12px; }
.import-steps li > span { background: var(--soft); color: var(--purple-dark); border-radius: 50%; width: 26px; height: 26px; flex-shrink: 0; text-align: center; padding-top: 4px; font-size: 12px; }
.import-steps strong { font-size: 13px; font-weight: 600; }
.import-steps p { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 6px 0; }
.command { border: 1px solid #e9e3f0; background: #f8f6fb; padding: 16px; border-radius: 9px; font-size: 12px; line-height: 1.8; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.token-field { display: flex; gap: 8px; }
.token-field input { font-family: monospace; font-size: 12px; }
.notice { color: var(--purple-dark); font-size: 13px; }
.upload-progress { position: fixed; bottom: 24px; right: 24px; z-index: 20; width: 340px; max-width: calc(100vw - 32px); background: white; padding: 20px; border: 1px solid #e3dbea; border-radius: 12px; box-shadow: 0 8px 45px #4c3b6b20; }
.upload-progress strong { display: block; font-size: 14px; margin-bottom: 14px; }
.upload-progress progress { width: 100%; height: 6px; accent-color: var(--purple); }
.upload-progress span { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; overflow-wrap: anywhere; }
#toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); z-index: 30; background: #454052; color: white; padding: 14px 23px; font-size: 13px; border-radius: 10px; max-width: 85vw; box-shadow: 0 6px 30px #30213b20; }
#toast.error-toast { background: #a45569; }
.htmx-request { cursor: progress; }
.htmx-request button[type=submit] { opacity: .6; }
.eyebrow { font-size: 10px; letter-spacing: 1.8px; color: var(--muted); font-weight: 600; }

/* Existing login identity. */
.login-page{display:flex;min-height:100vh;background:white}
.login-art{width:50%;background:#eeebf6;padding:40px 55px;display:flex;flex-direction:column;overflow:hidden;position:relative}
.login-art .brand{position:relative;z-index:1}
.login-story{margin:auto 0;padding-top:55px}
.login-story h1{font-size:44px;letter-spacing:-1.6px;line-height:1.2;margin:20px 0;color:#655178}
.login-story p{font-size:12px;line-height:1.9;color:#a393b1}
.login-note{display:flex;align-items:center;gap:7px;font-size:10px;color:#a797b6;position:relative;z-index:1}
.login-note svg{width:13px;height:13px}
.orbit{height:280px;max-width:370px;position:relative;margin:0 auto}
.orbit-ring{width:220px;height:220px;border:1px solid #dfd6ed;border-radius:50%;position:absolute;left:60px;top:35px;transform:rotate(-25deg);box-shadow:0 0 0 40px #e8e0f444,0 0 0 80px #e8e0f422}
.orbit-center{display:flex;align-items:center;justify-content:center;position:absolute;top:100px;left:120px;width:94px;height:94px;background:#ffffff80;box-shadow:0 10px 35px #a18bbb25;border:1px solid #fff;border-radius:25px;transform:rotate(-8deg);color:#a18aba}
.orbit-center svg{width:53px;height:53px}
.floating-file{position:absolute;display:flex;align-items:center;justify-content:center;width:57px;height:67px;border:1px solid white;border-radius:10px;background:#ffffffc4;box-shadow:0 10px 30px #b39ac520}
.floating-file svg{width:30px;height:30px}
.file-a{left:24px;top:60px;transform:rotate(-14deg);color:#b088bf}
.file-b{right:25px;top:90px;transform:rotate(13deg);color:#ce9a9e}
.file-c{left:130px;bottom:3px;transform:rotate(8deg);color:#c6ac79}
.login-form-wrap{width:50%;display:flex;align-items:center;justify-content:center;padding:50px;position:relative}
.login-form{max-width:340px;width:100%}
.login-form .small-logo{display:none}
.login-form h2{font-size:26px;letter-spacing:-.8px;font-weight:600;margin:15px 0 9px}
.login-form>p{font-size:12px;color:#a296ae;margin:0 0 35px}
.login-form label{font-size:11px;margin-top:20px;color:#82738f}
.login-form input{width:100%;font-size:12px;padding:14px;background:#fdfcfe}
.login-form input::placeholder{color:#b7afbf}
.login-form>.button{margin-top:25px;padding:14px;justify-content:space-between}
.private-note{display:flex;align-items:center;justify-content:center;gap:6px;color:#b4a9bf;font-size:9px;margin-top:24px}
.private-note svg{width:13px;height:13px}
.login-footer{position:absolute;bottom:35px;font-size:9px;color:#b8afc0;text-align:center}
.login-form>p.error,.error{color:#b8536e;background:#fff1f4;border:1px solid #f8dfe6;padding:12px;border-radius:9px;font-size:12px;line-height:1.6}
.login-art::after{content:"";position:absolute;bottom:-230px;left:-200px;width:600px;height:600px;border:1px solid #e0d7eb;border-radius:50%;pointer-events:none}

.login-form > p { font-size: 14px; color: var(--muted); }
.login-form label { font-size: 13px; color: var(--muted); }
.login-form input { font-size: 14px; }
.login-form input::placeholder { color: var(--muted); }
.login-story p { font-size: 14px; color: #79628e; }
.private-note, .login-footer, .login-note { color: var(--muted); font-size: 11px; }

/* Installed app: private content is never cached offline. */
.pwa-install { flex-shrink: 0; }
.login-install { position: absolute; bottom: 80px; }
.offline-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.offline-card { max-width: 440px; text-align: center; }
.offline-card > img { border-radius: 20px; margin-bottom: 26px; }
.offline-card h1 { font-size: 27px; }
.offline-card p { font-size: 14px; line-height: 1.8; color: var(--muted); }
.offline-card .button { margin: 14px 0; }
.offline-card .muted { font-size: 12px; }
#pwa-notices { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 22; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); width: max-content; }
.pwa-notice { display: flex; align-items: center; gap: 16px; background: #fff; padding: 14px 18px; box-shadow: 0 8px 35px #3c285b22; border: 1px solid #e6dff0; border-radius: 12px; font-size: 13px; color: #625370; max-width: 460px; }

@media (max-width: 1100px) {
  .sidebar { width: 200px; flex-basis: 200px; padding-left: 14px; padding-right: 14px; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .content { padding: 24px 28px; }
  .page-heading { align-items: flex-start; }
  .heading-actions { gap: 8px; }
  .heading-actions .button { padding: 10px 12px; }
  .type-col { display: none; }
  .file-table th:first-child { width: 50%; }
  .login-art { padding: 35px; }
  .login-story h1 { font-size: 36px; }
  .login-form-wrap { padding: 35px; }
}
@media (max-width: 900px) {
  .page-heading { flex-wrap: wrap; gap: 20px; }
  .date-col { display: none; }
  .file-table th:first-child { width: auto; }
  .size-col { width: 90px; }
  .layout-grid .size-col { width: auto; }
}
@media (max-width: 760px) {
  body:not(.login-page):not(.offline-page) { padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  .app-shell { display: block; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 12; width: 100%; height: auto; padding: 8px max(12px, env(safe-area-inset-left, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)); border: 0; border-top: 1px solid var(--line); }
  .sidebar .brand, .workspace-label, .sidebar-bottom { display: none; }
  .sidebar nav { flex-direction: row; gap: 5px; }
  .sidebar nav a { flex: 1; flex-direction: column; justify-content: center; gap: 4px; padding: 7px 2px; font-size: 11px; min-height: 54px; }
  .sidebar nav a:last-child { margin-top: 0; }
  .topbar { height: calc(80px + env(safe-area-inset-top, 0px)); gap: 12px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
  .search { min-width: 0; flex: 1; height: 46px; gap: 8px; padding-left: 12px; padding-right: 4px; }
  .search input, .login-form input, dialog input, dialog select { font-size: 16px; }
  .search-shortcut { display: none; }
  .utility-menu > summary, .search-submit { width: 44px; height: 44px; }
  .content { padding: 17px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px)); }
  .page-heading { margin-bottom: 27px; }
  .page-heading h1 { font-size: 27px; }
  .page-heading p { font-size: 13px; }
  .heading-actions { width: 100%; gap: 10px; }
  .heading-actions .button { flex: 1; font-size: 13px; }
  .button { min-height: 44px; }
  .view-controls { gap: 8px; }
  .file-toolbar { gap: 10px; flex-wrap: wrap; }
  .file-toolbar select { min-height: 44px; max-width: 145px; padding: 9px 5px 9px 8px; }
  .view-toggle .icon-button { width: 38px; height: 38px; }
  .file-table, .file-table tbody { display: block; }
  .file-table tr { display: grid; grid-template-columns: minmax(0, 1fr) 90px; }
  .file-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .file-table td { padding: 13px 10px; }
  .file-table td:first-child { padding-left: 14px; min-width: 0; }
  .file-table .actions-cell { width: 90px; display: flex; align-items: center; justify-content: flex-end; }
  .file-name-cell { gap: 10px; }
  .file-mobile-meta { display: block; }
  .file-link { font-size: 14px; padding: 0; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  button.file-link, a.file-link { min-height: 28px; }
  .file-details { position: relative; }
  button.file-link::after, a.file-link::after { content: ""; position: absolute; inset: 0; min-height: 44px; }
  .row-actions .icon-button { width: 38px; height: 44px; padding: 8px; }
  .type-col, .date-col, .size-col, .imported-mark { display: none; }
  .layout-grid .file-table tbody { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .layout-grid .file-table tr { padding: 18px; }
  .layout-grid .actions-cell { width: auto; }
  .layout-grid .file-link { min-height: 44px; }
  .layout-grid .file-link::after { display: none; }
  .layout-grid .size-col { width: auto; }
  .files-surface, .empty-state { min-height: 320px; }
  .empty-state { padding: 40px 20px; }
  .empty-state h3 { font-size: 17px; }
  .empty-state p { font-size: 13px; }
  .drop-hint { display: none; }
  dialog { padding: 28px 22px; }
  .dialog-close { width: 40px; height: 40px; }
  .preview-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); padding: 28px 16px; }
  .preview-heading h2 { font-size: 16px; }
  .preview-pdf { height: 65dvh; }
  .login-art { display: none; }
  .login-form-wrap { width: 100%; padding: 40px 30px 140px; min-height: 100dvh; }
  .login-form .small-logo { display: block; color: var(--purple); margin-bottom: 40px; }
  .small-logo svg { width: 40px; height: 40px; }
  .login-footer { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); padding: 0 20px; }
  .login-install { bottom: calc(57px + env(safe-area-inset-bottom, 0px)); }
  .upload-progress, #toast { bottom: calc(94px + env(safe-area-inset-bottom, 0px)); }
  .upload-progress { right: 16px; }
  #pwa-notices { bottom: calc(94px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 32px); }
  .pwa-notice { width: 100%; font-size: 12px; gap: 10px; }
  .pwa-notice .button { font-size: 12px; padding: 8px; }
}
@media (max-width: 380px) {
  .content { padding-left: 14px; padding-right: 14px; }
  .topbar { padding-left: 14px; padding-right: 14px; gap: 8px; }
  .file-toolbar { align-items: flex-start; }
  .view-controls { margin-left: auto; }
  .file-table td:first-child { padding-left: 10px; }
  .file-name-cell { gap: 8px; }
  .file-icon { width: 30px; height: 36px; }
  .file-table td { padding-left: 6px; padding-right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
