/* KaySuite Files — matches the KaySuite desktop palette. */
:root {
  --navy: #101b33; --navy-2: #1d2c4c; --blue: #3d65d5; --blue-dark: #3156be; --blue-soft: #e9efff;
  --bg: #f6f8fc; --card: #fff; --line: #e1e6f0; --text: #17243b; --muted: #69778d; --danger: #b42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.3px; }
h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none; }

.primary, .secondary, .danger-button { border-radius: 9px; padding: 9px 16px; font-weight: 700; border: 1px solid transparent; }
.primary { background: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.secondary { background: #fff; border-color: #c9d3e6; }
.danger-button { background: var(--danger); color: #fff; }
.wide { width: 100%; padding: 12px; }
.button-link { display: block; text-align: center; }
.link-button { border: 0; background: none; color: var(--blue); padding: 4px 6px; }
.danger-text { color: var(--danger) !important; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: #43516a; }
.field input, .field select { padding: 10px 12px; border: 1px solid #d3dbea; border-radius: 9px; background: #fff; font-weight: 400; font-size: 15px; }
.field input:focus, .field select:focus { outline: 2px solid #6685ef55; border-color: #6685ef; }
.field small { font-weight: 400; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-error { color: var(--danger); margin: 0; min-height: 1em; font-size: 13px; }
.notice { background: var(--blue-soft); color: #2b4fae; padding: 10px 12px; border-radius: 9px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong { display: block; font-size: 18px; }
.brand small { display: block; color: #94a3c1; font-size: 11px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: #5278f2; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; }

/* Sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #101b33 0 38%, var(--bg) 38%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px #10203a26; display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand small { color: var(--muted); }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex-shrink: 0; background: var(--navy); color: #e9eef8; padding: 22px 14px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { color: #b7c3d9; padding: 11px 14px; border-radius: 9px; font-weight: 500; }
.nav-item:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.nav-item.selected { background: #304c91; color: #fff; font-weight: 700; }
.usage { margin-top: auto; display: flex; flex-direction: column; gap: 7px; color: #9cacca; padding: 0 6px; }
.usage-bar { height: 6px; border-radius: 3px; background: #2a3a5b; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: #6f93ff; }
.usage-bar span.warn { background: #f59e0b; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 460px; }
.search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.account { display: flex; align-items: center; gap: 12px; }
.org { color: var(--muted); font-size: 13px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--blue-soft); color: #365ac4; font-weight: 800; font-size: 12px; }
.content { padding: 26px 28px 80px; }

/* Toolbar and tables */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 18px; font-weight: 700; }
.crumbs.small { font-size: 13px; margin-bottom: 8px; }
.crumbs .sep { color: #a7b2c4; }
.drop-zone { border-radius: 12px; min-height: 300px; }
.drop-zone.dragging { outline: 2px dashed var(--blue); outline-offset: 4px; background: var(--blue-soft); }
.files { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.files th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.files td { padding: 8px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.files tr:last-child td { border-bottom: 0; }
.files tbody tr:hover { background: #f7f9fe; }
.name-cell { max-width: 0; width: 60%; }
.name { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; max-width: 100%; text-align: left; padding: 4px 0; }
.name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-cell { text-align: right; white-space: nowrap; }
.more { border: 0; background: none; font-size: 20px; line-height: 1; padding: 4px 10px; border-radius: 7px; color: #43516a; }
.more:hover { background: var(--blue-soft); }
.disabled-row td { opacity: .55; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef2f7; color: var(--muted); margin-left: 6px; }
.section-title { font-size: 16px; margin: 26px 0 10px; }
.empty { text-align: center; padding: 70px 20px; border: 1px dashed #d3dbea; border-radius: 12px; background: #fff; }
.empty p { margin: 4px 0; }

/* File type icons */
.icon { width: 26px; height: 30px; flex-shrink: 0; border-radius: 5px; display: grid; place-items: center; font-size: 8px; font-weight: 800; color: #fff; background: #94a3b8; }
.icon::after { content: ""; }
.icon.folder { width: 30px; height: 24px; border-radius: 4px; background: #f5b83d; }
.icon.pdf { background: #d65353; } .icon.pdf::after { content: "PDF"; }
.icon.doc { background: #4169d9; } .icon.doc::after { content: "DOC"; }
.icon.sheet { background: #25945c; } .icon.sheet::after { content: "XLS"; }
.icon.slides { background: #db8236; } .icon.slides::after { content: "PPT"; }
.icon.image { background: #8055c9; } .icon.image::after { content: "IMG"; }

/* Dialogs */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 24px)); box-shadow: 0 24px 60px #10203a40; }
dialog::backdrop { background: #10203a66; }
.dialog-body header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.dialog-body h2 { font-size: 17px; overflow-wrap: anywhere; }
.close { border: 0; background: none; font-size: 24px; color: var(--muted); line-height: 1; }
.dialog-content { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.dialog-content p { margin: 0; }
.dialog-content h3 { font-size: 14px; margin-top: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.menu-list { display: flex; flex-direction: column; }
.menu-list button { border: 0; background: none; text-align: left; padding: 11px 10px; border-radius: 8px; font-size: 15px; }
.menu-list button:hover { background: var(--blue-soft); }
.picker-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; }
.picker-list button { display: flex; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid #eef1f6; background: #fff; text-align: left; padding: 9px 12px; }
.picker-list button:hover { background: var(--blue-soft); }
.picker-list p { padding: 12px; margin: 0; }
.share-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.share-form button { grid-column: 1 / -1; }
.new-link { display: flex; gap: 8px; }
.new-link input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid #bdcafa; border-radius: 8px; background: var(--blue-soft); }
.link-list { display: flex; flex-direction: column; gap: 6px; }
.link-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 13px; }

/* Uploads and toast */
.uploads { position: fixed; right: 18px; bottom: 18px; width: 320px; display: flex; flex-direction: column; gap: 6px; z-index: 30; }
.upload { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 24px #10203a1f; display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 13px; }
.upload progress { grid-column: 1 / -1; width: 100%; height: 6px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload.failed .upload-state { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 30px #10203a40; max-width: calc(100vw - 24px); }
.toast.error { background: #7a1712; }
.toast button { border: 0; background: none; color: #c7d3ee; font-size: 20px; line-height: 1; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; overflow-x: auto; }
  .sidebar .brand div, .usage { display: none; }
  .sidebar nav { flex-direction: row; }
  .nav-item { padding: 8px 10px; white-space: nowrap; }
  .topbar { padding: 0 12px; }
  .org { display: none; }
  .content { padding: 16px 12px 80px; }
  .hide-small { display: none; }
  .name-cell { width: auto; }
  .uploads { left: 12px; right: 12px; width: auto; }
  .share-form { grid-template-columns: 1fr; }
}
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Home dashboard */
.home-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.home-hero h1 { font-size: 30px; margin: 4px 0 6px; }
.home-hero p { margin: 0; }
.eyebrow { color: #5377e7; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.hero-actions { display: flex; gap: 10px; }
.hero-actions a:hover { text-decoration: none; }
.home-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 16px; }
.home-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.home-card h2 { font-size: 15px; margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.big { font-size: 24px; font-weight: 800; margin: 4px 0 12px; }
.big .muted { font-size: 14px; font-weight: 500; }
.usage-bar.light { height: 8px; border-radius: 4px; background: #e3e8f2; overflow: hidden; margin-bottom: 12px; }
.usage-bar.light span { display: block; height: 100%; background: var(--blue); }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.recent-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid #eef1f6; min-width: 0; }
.recent-list li:last-child { border-bottom: 0; }
.recent-list .name { min-width: 0; }
.recent-list .muted { white-space: nowrap; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.app-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 6px 14px; align-items: start; text-align: left; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.app-card:hover { text-decoration: none; border-color: #bdcafa; box-shadow: 0 10px 24px #1b2b4b12; transform: translateY(-2px); }
.app-card.soon { opacity: .78; }
.app-tile { grid-row: span 2; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 16px; }
.app-tile.blue { background: #e6edff; color: #4169d9; }
.app-tile.green { background: #e3f5eb; color: #25945c; }
.app-tile.teal { background: #e0f4f4; color: #0f8a8a; }
.app-tile.purple { background: #f0e8ff; color: #8055c9; }
.app-tile.red { background: #ffebeb; color: #d65353; }
.app-tile.orange { background: #fff0e3; color: #db8236; }
.app-text { display: flex; flex-direction: column; gap: 4px; }
.app-text span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.status-pill { justify-self: start; grid-column: 2; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 10px; }
.status-pill.live { background: #e3f5eb; color: #23663b; }
.status-pill.desktop { background: #e6edff; color: #2b4fae; }
.status-pill.soon { background: #eef1f6; color: var(--muted); }
@media (max-width: 760px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 24px; }
}
