:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #6f7974;
  --line: #e2e8e4;
  --accent: #176b4b;
  --accent-2: #dff2e8;
  --danger: #b63f3f;
  --shadow: 0 20px 50px rgba(20, 43, 32, .11);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 760; font-size: 19px; letter-spacing: -.02em; }
.brand-large { justify-content: center; font-size: 24px; margin-bottom: 36px; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: white; background: var(--accent); font-family: Georgia, serif; font-style: italic; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% -10%, #dbeee4, transparent 45%), var(--bg); }
.auth-card { width: min(440px, 100%); padding: 42px; background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.7); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card h1 { text-align: center; font-size: 30px; margin: 6px 0 8px; letter-spacing: -.04em; }
.auth-card > .muted, .auth-card > .eyebrow { text-align: center; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .13em; color: var(--accent); }
.muted { color: var(--muted); }
form label { display: grid; gap: 7px; margin: 18px 0; font-size: 13px; font-weight: 650; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,107,75,.1); }
button, .button-link { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 670; color: inherit; background: transparent; text-decoration: none; }
.primary { color: white; background: var(--accent); }
.primary:hover { background: #10593d; }
.secondary { background: white; border: 1px solid var(--line); }
.wide { width: 100%; margin-top: 8px; padding: 13px; }
.form-error { min-height: 18px; color: var(--danger); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 258px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 19px 18px; background: #e9efeb; border-right: 1px solid #dbe3de; }
.sidebar > .brand { padding: 0 10px 27px; }
#spaces, .side-bottom { display: grid; gap: 4px; }
#spaces button, .side-bottom button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border-radius: 9px; text-align: left; color: #536059; background: transparent; }
#spaces button:hover, .side-bottom button:hover, #spaces button.active { color: var(--ink); background: rgba(255,255,255,.72); }
#spaces button.active { box-shadow: 0 1px 3px rgba(0,0,0,.04); }
#spaces button span:first-child, .side-bottom button span { width: 20px; text-align: center; }
.storage-card { margin: 24px 7px 18px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.55); }
.storage-row { display: flex; justify-content: space-between; font-size: 11px; }
.progress { overflow: hidden; height: 5px; margin-top: 10px; border-radius: 10px; background: #d5ded8; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.side-bottom { margin-top: auto; padding-bottom: 13px; border-bottom: 1px solid #d5ddd8; }
.profile { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 15px 7px 0; }
.profile strong, .profile small { display: block; max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; color: var(--accent); border-radius: 50%; background: var(--accent-2); font-weight: 800; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 34px; background: rgba(255,255,255,.7); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.breadcrumbs { display: flex; gap: 5px; align-items: center; margin-top: 4px; font-size: 14px; font-weight: 650; }
.breadcrumbs button { padding: 0; color: var(--muted); }
.breadcrumbs button:last-child { color: var(--ink); }
.breadcrumbs i { font-style: normal; color: #aab2ad; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-button, .mobile-menu { width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); background: white; }
.mobile-menu { display: none; }
.content { padding: 34px; }
.content-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.content-head h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.035em; }
.content-head p { margin: 0; font-size: 13px; }
.search { display: flex; align-items: center; gap: 8px; width: 260px; padding-left: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white; }
.search input { border: 0; padding-left: 0; box-shadow: none; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.file-card { position: relative; min-height: 165px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: transform .15s, box-shadow .15s; overflow: hidden; }
.file-card:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(30,60,45,.08); }
.file-card .thumb { display: grid; place-items: center; height: 86px; margin: -14px -14px 12px; color: var(--accent); background: #edf4ef; font-size: 40px; overflow: hidden; }
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-card small { color: var(--muted); font-size: 11px; }
.more { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(0,0,0,.06); background: rgba(255,255,255,.9); }
.file-list.list { display: table; width: 100%; border-collapse: separate; border-spacing: 0 5px; }
.file-list.list .file-card { display: grid; grid-template-columns: 50px 1fr 120px 40px; align-items: center; min-height: 58px; padding: 6px 10px; }
.file-list.list .thumb { grid-row: 1; width: 43px; height: 43px; margin: 0; border-radius: 9px; font-size: 20px; }
.file-list.list .meta { grid-column: 2; }
.file-list.list .file-date { display: block; grid-column: 3; }
.empty { padding: 90px 20px; text-align: center; color: var(--muted); }
.empty h2 { margin: 15px 0 6px; color: var(--ink); }
.empty p { margin: 0; }
.empty-icon { font-size: 48px; color: #9bbbaa; }
.drop-zone { position: fixed; inset: 20px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 22px; color: var(--accent); background: rgba(235,247,240,.94); font-size: 22px; font-weight: 750; }
dialog { border: 0; }
dialog::backdrop { background: rgba(15,24,20,.46); backdrop-filter: blur(3px); }
.popover { margin: 95px 34px 0 auto; padding: 8px; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.popover button { display: flex; align-items: center; gap: 12px; width: 270px; padding: 12px; text-align: left; }
.popover button:hover { background: var(--bg); }
.popover strong, .popover small { display: block; }
.popover small { color: var(--muted); margin-top: 3px; }
.modal { width: min(480px, calc(100% - 30px)); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.modal-head, .panel-head, .preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.modal h2, .panel-modal h2 { margin: 4px 0 0; font-size: 23px; }
.close { width: 38px; height: 38px; padding: 0; font-size: 25px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 23px; }
.preview-modal { width: 94vw; height: 92vh; padding: 0; border-radius: 18px; overflow: hidden; background: #101412; color: white; }
.preview-bar { height: 60px; padding: 0 18px; background: #1b211e; }
.preview-bar .close { color: white; }
.button-link { display: inline-block; color: white; border: 1px solid #48504c; }
.preview-body { display: grid; place-items: center; height: calc(100% - 60px); }
.preview-body img, .preview-body video { max-width: 100%; max-height: 100%; }
.preview-body audio { width: min(640px, 85%); }
.panel-modal { width: min(850px, 94vw); max-height: 88vh; padding: 0; border-radius: 20px; overflow: hidden; }
.panel-head { position: sticky; top: 0; z-index: 2; padding: 23px 27px; background: white; border-bottom: 1px solid var(--line); }
#panel-content { padding: 25px 27px; overflow: auto; max-height: calc(88vh - 90px); }
.settings-section + .settings-section { margin-top: 32px; }
.settings-section h3 { margin: 0 0 6px; }
.settings-section > p { margin: 0 0 18px; }
.row-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row-card small { display: block; margin-top: 3px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; }
.danger { color: var(--danger); background: #fff1f1; }
.token-secret { padding: 14px; border: 1px solid #bfdcca; border-radius: 11px; word-break: break-all; background: #eef9f2; font-family: ui-monospace, monospace; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 100; transform: translateY(100px); padding: 13px 17px; border-radius: 11px; color: white; background: #17201c; box-shadow: var(--shadow); opacity: 0; transition: .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.context-menu { position: fixed; z-index: 50; min-width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: var(--shadow); }
.context-menu button { display: block; width: 100%; padding: 9px 11px; text-align: left; }
.context-menu button:hover { background: var(--bg); }
.read-only-badge { display: inline-block; margin-left: 7px; padding: 3px 7px; border-radius: 20px; color: #785b20; background: #fff1cf; font-size: 10px; }
@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 40; width: 270px; transform: translateX(-100%); transition: .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: block; }
  .topbar { padding: 0 16px; }
  .topbar .secondary { display: none; }
  .content { padding: 22px 16px; }
  .content-head { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .file-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

