/* Palette and control geometry match Psalm Chat. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --ink: #202020;
  --muted: #707070;
  --line: #e6e6e6;
  --accent: #202020;
  --accent-hover: #414141;
  --on-accent: #fff;
  --tint: #ededed;
  --hover: #f5f5f5;
  --chrome: #fff;
  --separator: rgba(0,0,0,.08);
  --danger: #c52a25;
  --danger-fill: #fff0ee;
  --shadow: 0 16px 64px #00000014;
  --rail: 80px;
  --sidebar: 284px;
  --tab-height: 65px;
  color: var(--ink);
  background: var(--bg);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1d1f;
  --surface: #252527;
  --ink: #f4f4f4;
  --muted: #adadaf;
  --line: #3b3b3d;
  --accent: #f4f4f4;
  --accent-hover: #d8d8da;
  --on-accent: #202020;
  --tint: #353537;
  --hover: #2c2c2e;
  --chrome: #1d1d1f;
  --separator: rgba(255,255,255,.1);
  --danger: #ff8982;
  --danger-fill: #401c1b;
  --shadow: 0 16px 64px #00000059;
}
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;min-width:280px}
button,input,select{font:inherit}
button,a,input,select{touch-action:manipulation}
button{cursor:pointer}
button:disabled{cursor:default;opacity:.5}
a{color:inherit;text-decoration:none}
:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
[data-icon],.icon{display:inline-flex;align-items:center;justify-content:center;flex:none}
.icon svg,[data-icon] svg{height:19px;width:19px;display:block}
.button,.icon-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid transparent;border-radius:999px;line-height:1.2;min-height:44px;font-size:14px;font-weight:600;color:var(--ink);background:transparent;text-decoration:none;white-space:nowrap}
.button{padding:0 13px}
.icon-button{width:44px;padding:0}
.icon-button:hover,.secondary:hover{background:var(--hover)}
.primary{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
.primary:hover{background:var(--accent-hover)}
.secondary{background:var(--hover);border-color:var(--line)}
.destructive{color:var(--danger);background:var(--danger-fill)}
.destructive:hover{background:color-mix(in srgb,var(--danger) 18%,var(--surface))}
.loading{min-height:100dvh;display:grid;place-items:center;color:var(--muted)}
.psalm-logo{display:block;width:58px;height:auto;object-fit:contain;flex:none}
[data-theme="dark"] .psalm-logo{filter:invert(1)}
.signin{min-height:100dvh;display:grid;place-items:center;padding:40px 24px;background:var(--bg)}
.signin-card{width:min(100%,400px);padding:24px 16px;text-align:center}
.signin-logo{width:112px;margin:0 auto 36px}
.signin-card h1{font-size:30px;font-weight:600;letter-spacing:-.8px;line-height:1.3;margin:0 0 12px}
.signin-card p{color:var(--muted);font-size:14px;line-height:1.75;margin:0 0 30px}
.signin-card #signin-message{margin-bottom:14px;padding:10px;border-radius:12px;background:var(--danger-fill);color:var(--danger)}
.signin-button{min-height:52px;width:100%;gap:9px}
.signin-card #retry-session{margin-top:12px;width:100%}
.shell{min-height:100dvh;display:grid;grid-template-columns:var(--rail) var(--sidebar) minmax(0,1fr)}
.rail,.sidebar{position:sticky;top:0;height:100dvh;border-right:1px solid var(--separator)}
.rail{display:flex;align-items:center;flex-direction:column;gap:20px;padding:28px 0 22px;background:var(--hover)}
.nav{display:flex;flex:1;width:100%;align-items:center;flex-direction:column;gap:5px;margin-top:19px}
.nav-button{width:66px;min-height:56px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:7px 2px;border:0;border-radius:18px;background:none;color:var(--muted);font-size:11px;line-height:1.3}
.nav-button [data-icon] svg{width:23px;height:23px}
.nav-button:hover,.nav-button[aria-current="page"]{color:var(--accent)}
.nav-button[aria-current="page"]>span:last-child{font-weight:650}
.nav-button[aria-current="page"] svg{stroke-width:2.05}
.sidebar{display:flex;flex-direction:column;overflow:hidden;padding:29px 12px 16px;background:var(--bg)}
.brand{display:flex;align-items:center;gap:11px;padding:7px 9px;letter-spacing:-.5px;font-size:20px}
.folder-sidebar{display:flex;flex-direction:column;min-height:0;padding:28px 0 12px}
.folder-sidebar h2{margin:0 0 8px;padding:0 11px;color:var(--muted);font-weight:500;font-size:12px}
#sidebar-folders{min-height:0;overflow:auto;scrollbar-width:thin}
.folder-shortcut{display:flex;width:100%;min-height:53px;min-width:0;gap:10px;align-items:center;text-align:left;padding:10px 12px;border:0;border-radius:16px;background:transparent;color:var(--ink);font-weight:550;font-size:14px}
.folder-shortcut svg{color:var(--muted)}
.folder-shortcut:hover,.folder-shortcut[aria-current="location"]{background:var(--hover)}
.folder-shortcut>span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.folder-empty{margin:9px 11px 0;color:var(--muted);font-size:13px}
.sidebar-bottom{margin-top:auto}
.storage{padding:13px 11px 15px;font-size:12px}
.storage-title{display:flex;align-items:center;gap:7px;font-size:13px;font-weight:700}
.storage-title svg{width:16px;height:16px}
.storage progress,.task progress{width:100%;height:7px;appearance:none;border:0;border-radius:10px;background:var(--tint)}
progress::-webkit-progress-bar{background:var(--tint);border-radius:10px}
progress::-webkit-progress-value{background:var(--accent);border-radius:10px}
progress::-moz-progress-bar{background:var(--accent);border-radius:10px}
.storage progress{margin:12px 0 4px}
.muted{color:var(--muted)}
.profile{min-width:0;display:flex;align-items:center;gap:8px;border-top:1px solid var(--separator);padding:13px 2px 0 8px}
.avatar{display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:var(--tint);color:var(--ink);flex:none;font-size:14px;font-weight:800}
.profile-name{flex:1;font-size:13px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top{min-height:75px;padding:0 clamp(18px,4vw,48px);display:flex;align-items:center;gap:13px;border-bottom:1px solid var(--line);background:var(--chrome)}
.search{display:flex;align-items:center;gap:10px;background:var(--hover);border:0;border-radius:999px;color:var(--muted);padding:0 14px;min-height:46px;width:min(410px,100%);margin-right:auto}
.search:focus-within{outline:2px solid var(--accent);outline-offset:2px}
.search input{border:0;background:none;outline:none;color:var(--ink);min-width:0;width:100%;font-size:14px}
.search input:focus-visible{outline:none}
kbd{display:inline-grid;place-items:center;width:22px;height:23px;border:1px solid var(--line);border-radius:5px;font-size:12px;color:var(--muted)}
.count{font-size:11px;background:var(--tint);color:var(--accent);padding:2px 5px;border-radius:6px}
.mobile-logout,.theme-mobile{display:none}
.workspace-body{position:relative;max-width:1440px;margin-inline:auto;padding:33px clamp(18px,4vw,48px) 48px}
.page-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-end;margin-bottom:23px}
.page-head h1{letter-spacing:-.04em;margin:0;font-size:clamp(25px,4vw,32px);line-height:1.2;overflow-wrap:anywhere}
.page-head p{font-size:13px;color:var(--muted);margin:9px 0 0;line-height:1.5}
.actions{display:flex;gap:8px;flex:none;align-items:center}
.breadcrumbs{display:flex;flex-wrap:wrap;align-items:center;gap:4px;color:var(--muted);font-size:12px;margin-bottom:9px}
.breadcrumbs button{border:0;background:transparent;color:var(--accent);padding:2px 2px;font-size:12px}
.file-panel{background:var(--surface);border:1px solid var(--separator);border-radius:18px;min-height:365px}
.file-toolbar{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:14px 17px;min-height:61px}
.file-toolbar h2{font-size:14px;margin:0;font-weight:750}
.sort{display:flex;align-items:center;gap:5px;color:var(--muted);font-size:13px}
.sort select{border:0;background:transparent;color:inherit;cursor:pointer;max-width:120px}
.sort svg{height:16px;width:16px}
.files-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:13px}
.files-table th{font-weight:650;font-size:12px;color:var(--muted);text-align:left;background:var(--hover)}
.files-table th,.files-table td{padding:10px 14px;border-top:1px solid var(--separator)}
.files-table th:first-child,.files-table td:first-child{padding-left:17px}
.files-table th:nth-child(2){width:102px}
.files-table th:nth-child(3){width:147px}
.files-table th:last-child{width:58px;padding-right:14px}
.files-table td:nth-child(2),.files-table td:nth-child(3){color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.files-table tbody tr:hover{background:var(--hover)}
.file-link{display:flex;align-items:center;gap:10px;width:100%;min-width:0;text-align:left;background:none;border:0;padding:0;color:var(--ink);font-weight:650;min-height:37px}
.file-link:hover .file-name{text-decoration:underline;text-decoration-color:var(--muted);text-underline-offset:3px}
.file-link .file-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.file-icon{width:34px;height:34px;border-radius:11px;color:var(--accent);background:var(--tint)}
.file-icon svg{height:17px;width:17px}
.more{position:relative}
.more summary{list-style:none;cursor:pointer}
.more summary::-webkit-details-marker{display:none}
.more[open] .menu{position:absolute;z-index:5;right:2px;top:36px;width:145px;background:var(--surface);border:1px solid var(--line);border-radius:9px;box-shadow:0 12px 25px #22223a19;padding:5px}
.menu button{display:block;width:100%;text-align:left;padding:8px;border:0;background:transparent;color:var(--ink);border-radius:5px;font-size:13px}
.menu button:hover{background:var(--tint)}
.menu button.danger{color:var(--danger)}
.empty{min-height:300px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:27px 20px;color:var(--muted);border-top:1px solid var(--separator);font-size:14px}
.empty .illustration{width:60px;height:60px;border-radius:17px;background:var(--tint);color:var(--accent);margin-bottom:12px}
.empty .illustration svg{width:30px;height:30px}
.empty strong{color:var(--ink);font-size:17px}
.empty p{max-width:320px;margin:8px 0 0;line-height:1.6}
.empty .button{margin-top:14px}
.pager{border-top:1px solid var(--line);display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:12px 17px;font-size:13px}
.drop-overlay{position:absolute;z-index:8;inset:10px 16px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;border:2px dashed var(--accent);border-radius:18px;background:color-mix(in srgb,var(--tint) 92%,transparent);color:var(--ink);pointer-events:none;font-weight:750}
.drop-overlay svg{width:34px;height:34px}
.dialog{padding:0;border:1px solid var(--line);border-radius:24px;color:var(--ink);width:min(460px,calc(100% - 24px));background:var(--surface);box-shadow:var(--shadow);max-height:min(84dvh,720px);overflow:auto}
.dialog::backdrop{background:#0006}
.dialog-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px 12px 20px;border-bottom:1px solid var(--line);gap:8px}
.dialog-header h2{font-size:17px;margin:0;overflow-wrap:anywhere}
.dialog-body{padding:20px;overflow-wrap:anywhere}
.dialog-body p{font-size:14px;margin:0 0 15px;color:var(--muted);line-height:1.6}
.dialog-body label{display:grid;gap:7px;font-size:13px;font-weight:700}
.dialog-body input,.dialog-body select{border:1px solid var(--line);border-radius:8px;padding:9px 10px;min-width:0;width:100%;color:var(--ink);background:var(--surface)}
.dialog-footer{display:flex;gap:8px;justify-content:flex-end;padding:0 20px 17px}
.dialog-error{color:var(--danger)!important}
.preview-dialog{width:min(860px,calc(100% - 24px))}
.preview-dialog img,.preview-dialog video{display:block;max-width:100%;max-height:60dvh;margin:auto}
.preview-dialog video{width:100%;background:#1f2025}
.preview-dialog audio{display:block;width:100%}
.queue-dialog{width:min(565px,calc(100% - 24px))}
.task{padding:15px 19px;border-bottom:1px solid var(--line)}
.task:last-child{border-bottom:0}
.task-title{display:flex;justify-content:space-between;gap:10px;font-weight:700;font-size:14px}
.task-title span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.task-title span:last-child{flex:none;color:var(--muted);font-weight:500;font-size:12px}
.task-actions{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:6px}
.task-actions>span{font-size:12px;color:var(--muted);min-width:0}
.task-buttons{display:flex;flex-wrap:wrap;gap:5px;flex:none}
.task-buttons button{background:none;border:0;color:var(--accent);padding:7px 5px;font-size:12px;border-radius:5px}
.task-buttons button:hover{background:var(--tint)}
.toasts{position:fixed;z-index:20;right:18px;bottom:18px;display:grid;gap:8px;max-width:calc(100% - 36px);pointer-events:none}
.toast{border-radius:999px;background:var(--tint);color:var(--ink);box-shadow:0 3px 12px #00000018;padding:12px 15px;font-size:13px;overflow-wrap:anywhere}
@media(max-width:1050px){
  :root{--rail:70px;--sidebar:225px}
  .top{min-height:65px}
  .files-table th:nth-child(3){width:118px}
  .files-table th:nth-child(2){width:80px}
  .workspace-body{padding-top:26px}
}
@media(max-width:768px){
  .shell{display:flex;flex-direction:column;padding-bottom:calc(var(--tab-height) + env(safe-area-inset-bottom))}
  .rail{position:fixed;z-index:9;top:auto;bottom:0;left:0;right:0;height:calc(var(--tab-height) + env(safe-area-inset-bottom));padding:0 0 env(safe-area-inset-bottom);border:0;border-top:1px solid var(--separator);background:var(--chrome)}
  .nav{flex-direction:row;justify-content:space-around;align-items:center;margin:0;gap:0}
  .nav-button{width:auto;flex:1;max-width:128px;min-height:60px;font-size:11px}
  .theme-button{display:none}
  .sidebar{position:static;display:flex;flex-direction:row;justify-content:space-between;align-items:center;height:auto;padding:calc(9px + env(safe-area-inset-top)) 16px 3px;border:0;gap:8px}
  .brand{padding:1px 0;gap:9px;font-size:16px;white-space:nowrap}
  .brand .psalm-logo{width:39px}
  .folder-sidebar,.storage-title,.profile{display:none}
  .sidebar-bottom{margin:0;min-width:0}
  .storage{display:flex;gap:6px;align-items:center;padding:0;font-size:11px;white-space:nowrap}
  .storage progress{width:clamp(24px,10vw,60px);margin:0}
  .mobile-logout,.theme-mobile{display:inline-flex;width:40px;min-height:40px}
  .top{min-height:59px;gap:3px;padding:3px 12px}
  .top .button{min-height:40px;padding:0 9px}
  .search{min-height:42px;margin-right:4px}
  .search input{font-size:14px}
  .search kbd,.queue-label{display:none}
  .page-head{flex-wrap:wrap;align-items:flex-start;margin-bottom:15px;gap:9px}
  .page-head>div:first-child{min-width:0;width:100%}
  .page-head p{margin-top:4px}
  .workspace-body{padding:17px 16px 28px}
  .actions{justify-content:flex-end;width:100%}
  .actions .button{font-size:13px;padding:0 12px}
  .file-panel{min-height:285px}
  .file-toolbar{padding:9px 12px;min-height:48px}
  .files-table th:first-child,.files-table td:first-child{padding-left:12px}
  .files-table th,.files-table td{padding:6px 5px}
  .files-table th:nth-child(3),.files-table td:nth-child(3){display:none}
  .files-table th:nth-child(2){width:66px}
  .files-table th:last-child{width:50px}
  .file-link{gap:7px;font-size:14px;min-height:45px}
  .file-icon{width:34px;height:34px}
  .empty{min-height:225px}
  .toasts{bottom:calc(79px + env(safe-area-inset-bottom))}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important}}
