/* Fermium app styles. */

:root {
  --bg: #fcfcfc;
  --bg-alt: #eff0f1;
  --fg: #232629;
  --muted: #6e7175;
  --accent: #3daee9;          /* KDE Breeze blue */
  --accent-soft: #d6ecf8;
  --border: #d4d6d8;
  --danger: #da4453;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1e20;
    --bg-alt: #232629;
    --fg: #eff0f1;
    --muted: #9a9ea2;
    --accent: #3daee9;
    --accent-soft: #17394c;
    --border: #3a3d40;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 "Segoe UI", "Noto Sans", system-ui, sans-serif;
}
main { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 4.5rem; }
a { color: var(--accent); text-decoration: none; }
code { background: var(--bg-alt); padding: 0.1em 0.35em; border-radius: 4px; word-break: break-all; }
hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; color: var(--fg); }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand span { color: var(--accent); }
.views { display: flex; gap: 0.25rem; }
.views a {
  padding: 0.3rem 0.75rem; border-radius: var(--radius); color: var(--fg);
}
.views a.active, .views a:hover { background: var(--accent-soft); color: var(--accent); }
.who { color: var(--muted); font-size: 0.85rem; }
.inline-form { display: inline; }

/* Buttons */
.button, button {
  font: inherit; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
  padding: 0.35rem 0.9rem;
  display: inline-block;
}
.button:hover, button:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; border: none; color: var(--muted); }
button.ghost:hover { color: var(--fg); }

/* Layout: Places sidebar + browser (the KDE split) */
.layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.layout .browser { flex: 1; min-width: 0; }
.sidebar {
  width: 176px; flex-shrink: 0;
  padding: 0.75rem 0.35rem 1rem 0;
  border-right: 1px solid var(--border);
  position: sticky; top: 0.5rem;
}
.places-head {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  margin: 0.9rem 0 0.3rem 0.5rem;
}
.places-head:first-child { margin-top: 0; }
.place {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.28rem 0.5rem; border-radius: var(--radius);
  color: var(--fg); font-size: 0.9rem;
  overflow: hidden; white-space: nowrap;
}
.place:hover { background: var(--accent-soft); color: var(--accent); }
.place.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.place-icon { flex-shrink: 0; }
.place-count {
  margin-left: auto; font-size: 0.72rem; color: var(--muted);
  background: var(--bg-alt); border-radius: 8px; padding: 0 0.4rem;
}
.place.drop-target, .tile.folder-tile.drop-target {
  outline: 2px dashed var(--accent); outline-offset: -2px;
  background: var(--accent-soft);
}
@media (max-width: 800px) { .sidebar { display: none; } }

/* Tag chips */
.chip {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 9px; padding: 0.05rem 0.5rem; margin: 0 0.15rem 0.15rem 0;
  white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0; min-height: 1.4rem; }
.chips .chip { font-size: 0.82rem; padding: 0.15rem 0.6rem; }
.chips .chip button {
  border: none; background: none; padding: 0 0 0 0.3rem; margin: 0;
  color: inherit; font-weight: 700; cursor: pointer; line-height: 1;
}

/* Toolbar / breadcrumbs */
.toolbar {
  display: flex; align-items: center; gap: 0.6rem; margin: 0.75rem 0 1rem;
  flex-wrap: wrap;
}
.toolbar h2 { margin: 0; font-size: 1.15rem; }
.breadcrumb {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 1.05rem; min-width: 0;
}
.crumb { color: var(--accent); }
.crumb.current {
  color: var(--fg); font-weight: 600;
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb-sep { color: var(--muted); }
.toolbar-select {
  font: inherit; padding: 0.3rem 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}
.view-toggle { display: inline-flex; }
.view-toggle button {
  padding: 0.3rem 0.6rem; line-height: 1.2; border-radius: 0;
}
.view-toggle button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-toggle button:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.view-toggle button[aria-pressed="true"] {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent);
}

/* "New" dropdown */
.menu-wrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60;
  min-width: 180px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  padding: 4px;
}
.dropdown button {
  display: block; width: 100%; text-align: left;
  border: none; background: none; border-radius: 4px;
  padding: 0.4rem 0.75rem;
}
.dropdown button:hover { background: var(--accent-soft); color: var(--accent); }

/* Icon grid (the Dolphin part) */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.5rem;
}
.tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.3rem;
  padding: 0.9rem 0.5rem 0.7rem;
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: default; user-select: none;
  min-width: 0;
}
.tile:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.tile.selected, .tile:focus {
  background: var(--accent-soft);
  border-color: var(--accent);
  outline: none;
}
.tile-icon {
  position: relative;
  font-size: 2.3rem; line-height: 1;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt); border-radius: 10px;
  flex-shrink: 0;
}
.tile-icon .glyph { pointer-events: none; }
.code-glyph {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.5rem; font-weight: 700; color: var(--accent);
}
.icon-image { background: #223a2c; }
.icon-pdf { background: #3a2626; }
.icon-snippet { background: #20262e; }
.icon-markdown { background: #2c2a38; }
.icon-folder { background: var(--accent-soft); }
@media (prefers-color-scheme: light) {
  .icon-image { background: #e2f0e6; }
  .icon-pdf { background: #f6e4e4; }
  .icon-snippet { background: #e8ecf2; }
  .icon-markdown { background: #ece8f4; }
}
.tile.folder-tile .tile-icon { font-size: 2.5rem; }
.lang-badge {
  position: absolute; right: -6px; bottom: -6px;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  background: var(--accent); color: #fff;
  border-radius: 4px; padding: 1px 4px;
  max-width: 58px; overflow: hidden; text-overflow: ellipsis;
}
.vis-emblem {
  position: absolute; left: -6px; top: -6px;
  font-size: 0.85rem; line-height: 1;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 50%; padding: 2px;
}
.tile-name {
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600;
}
.tile-name input {
  font: inherit; width: 100%; text-align: center;
  border: 1px solid var(--accent); border-radius: 4px;
  background: var(--bg); color: var(--fg); padding: 0 0.2rem;
}
.tile-meta { font-size: 0.72rem; color: var(--muted); }

/* Pills (visibility / listing badges) */
.pill {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0.05rem 0.55rem; color: var(--muted);
}
.pill.vis-password { color: #b08000; border-color: #b08000; }
.pill.vis-unlisted { color: var(--muted); }
.pill.listing-team { color: var(--accent); border-color: var(--accent); }

/* Detail-list mode */
.list-header { display: none; }
.browser.view-list .tiles { display: block; }
.browser.view-list .list-header,
.browser.view-list .tile {
  display: grid;
  grid-template-columns:
    40px minmax(150px, 1.7fr) minmax(84px, 0.9fr) 70px 84px minmax(90px, 1fr) 76px 112px;
  align-items: center; gap: 0.5rem;
  text-align: left;
}
.browser.view-list .col-tags .chip { margin-bottom: 0; }
.browser.view-list .list-header.files-header,
.browser.doc-view.view-list .tile {
  grid-template-columns: 40px minmax(160px, 2fr) minmax(120px, 1fr) 90px;
}
.browser.view-list .list-header {
  padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border);
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.browser.view-list .tile {
  padding: 0.25rem 0.5rem; border-radius: 4px;
}
.browser.view-list .tile-icon {
  width: 30px; height: 30px; font-size: 1.05rem; border-radius: 6px;
}
.browser.view-list .tile-icon .code-glyph { font-size: 0.8rem; }
.browser.view-list .lang-badge { display: none; }
.browser.view-list .vis-emblem { display: none; }
.browser.view-list .tile-name { font-weight: 500; text-align: left; }
.browser.view-list .tile-name input { text-align: left; }
.browser.view-list .tile-meta { display: none; }
.browser.view-list .col {
  font-size: 0.8rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.browser:not(.view-list) .col { display: none; }

.empty { color: var(--muted); padding: 3rem 1rem; text-align: center; }

/* Status bar */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.3rem 1.25rem;
  background: var(--bg-alt); border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--muted);
}
.sb-sel {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45vw;
}

/* Context menu */
.ctx-menu {
  position: fixed; z-index: 100; min-width: 200px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  padding: 4px;
}
.ctx-menu button {
  display: block; width: 100%; text-align: left;
  border: none; background: none; border-radius: 4px;
  padding: 0.4rem 0.75rem;
}
.ctx-menu button:hover { background: var(--accent-soft); color: var(--accent); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button.danger:hover { background: rgba(218, 68, 83, 0.12); color: var(--danger); }
.ctx-sub { position: relative; }
.ctx-submenu {
  display: none;
  position: absolute; left: 100%; top: -5px; min-width: 190px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  padding: 4px;
}
.ctx-sub:hover .ctx-submenu { display: block; }

/* Drag & drop */
.browser.dragover { outline: 2px dashed var(--accent); outline-offset: -6px; }
.drophint {
  position: fixed; inset: auto 1rem 2.4rem 1rem; z-index: 90;
  text-align: center; padding: 1rem;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  pointer-events: none;
}

/* Modal dialogs (snippet / paste-image publish) */
dialog.modal {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--fg);
  padding: 1.25rem 1.5rem; width: min(640px, 92vw);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.modal h3 { margin: 0 0 1rem; }
dialog.modal label {
  display: block; margin: 0.6rem 0; font-size: 0.85rem; color: var(--muted);
}
dialog.modal input[type="text"], dialog.modal input[type="password"],
dialog.modal select, dialog.modal textarea {
  display: block; width: 100%; margin-top: 0.2rem;
  font: inherit; padding: 0.35rem 0.6rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}
dialog.modal textarea {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem; resize: vertical; white-space: pre; overflow-x: auto;
}
.modal-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.modal-row label { flex: 1; min-width: 140px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem;
}
.paste-preview {
  display: flex; justify-content: center; margin-bottom: 0.5rem;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem;
}
.paste-preview img { max-width: 100%; max-height: 260px; }

/* Doc facts */
.doc-facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem;
  margin: 0 0 1.25rem; font-size: 0.9rem;
}
.doc-facts dt { color: var(--muted); }
.doc-facts dd { margin: 0; }

/* Tokens */
.mint-form { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
.mint-form input, .mint-form select {
  font: inherit; padding: 0.35rem 0.6rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
}
.mint-form input { flex: 1; min-width: 200px; }
.token-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.token-table th, .token-table td {
  text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.token-table th { color: var(--muted); font-weight: 600; }
.token-table tr.revoked td { color: var(--muted); text-decoration: line-through; }
.code-block {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem 1rem; overflow-x: auto; font-size: 0.82rem;
}

/* Notices, login, toast */
.notice {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 0.75rem 1rem; margin: 1rem 0;
}
.login-card {
  max-width: 430px; margin: 14vh auto 0; text-align: center;
  padding: 2rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-alt);
}
.login-card h1 { margin-top: 0; }
.login-card .accent { color: var(--accent); }
.toast {
  position: fixed; bottom: 2.4rem; left: 50%; transform: translateX(-50%);
  z-index: 200;
  background: var(--fg); color: var(--bg);
  padding: 0.5rem 1.1rem; border-radius: 20px; font-size: 0.85rem;
}

/* Sign-in / consent */
.login-card .login-points { text-align: left; margin: 0.75rem auto 1rem; padding-left: 1.1rem; color: var(--muted, #7a7f86); font-size: 0.92rem; line-height: 1.5; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; text-align: left; margin: 1rem 0 0.75rem; font-size: 0.92rem; line-height: 1.4; }
.consent input { margin-top: 0.2rem; flex: none; }
.button.primary.disabled, .button.primary[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.small { font-size: 0.82rem; }
.accept-form { margin-top: 0.5rem; }
.accept-form .button { margin-top: 0.5rem; }

/* Admin */
.admin-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0 1rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { text-align: left; vertical-align: top; padding: 0.5rem 0.4rem; border-top: 1px solid var(--border, #dde0e3); }
.admin-table .member { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.25rem; }
.admin-table .member.disabled span { text-decoration: line-through; opacity: 0.6; }
button.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }

/* Custom domains */
.cd-list { display: grid; gap: 0.75rem; margin: 0.75rem 0; }
.cd-card { border: 1px solid var(--border, #dde0e3); border-radius: 8px; padding: 0.75rem 0.9rem; }
.cd-head { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.cd-records { width: 100%; font-size: 0.85rem; margin: 0.5rem 0; border-collapse: collapse; }
.cd-records th, .cd-records td { text-align: left; padding: 0.25rem 0.4rem; border-top: 1px solid var(--border, #dde0e3); }
.cd-records code { word-break: break-all; }
.cd-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.cd-error { color: #c0392b; }
.cd-card.status-active .pill { background: #2e7d32; color: #fff; }
.cd-card.status-error .pill { background: #c0392b; color: #fff; }

/* Admin inbox */
.page.wide { max-width: none; }
.mail-toolbar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.mail-toolbar h2 { margin: 0; }
.mail-split { display: grid; grid-template-columns: minmax(260px, 34%) 1fr; gap: 1rem; min-height: 60vh; }
.mail-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border, #dde0e3); border-radius: 8px; overflow: auto; max-height: 75vh; }
.mail-row { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border, #dde0e3); cursor: pointer; }
.mail-row:hover { background: rgba(127,127,127,0.08); }
.mail-row.active { background: rgba(242,163,58,0.15); }
.mail-row.unseen .mail-subject, .mail-row.unseen .mail-from { font-weight: 600; }
.mail-row-top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; }
.mail-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { color: var(--muted, #7a7f86); flex: none; }
.mail-subject { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-reader { border: 1px solid var(--border, #dde0e3); border-radius: 8px; padding: 1rem; overflow: auto; max-height: 75vh; }
.mail-head h3 { margin: 0 0 0.25rem; }
.mail-actions { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
#mail-frame { width: 100%; min-height: 50vh; border: 1px solid var(--border, #dde0e3); border-radius: 6px; background: #fff; }
.mail-text { white-space: pre-wrap; word-break: break-word; font: 0.9rem/1.5 system-ui, sans-serif; }
.mail-reply { margin-top: 1rem; display: grid; gap: 0.5rem; }
.mail-reply label { display: grid; gap: 0.2rem; font-size: 0.85rem; }
.mail-reply input, .mail-reply textarea { font: inherit; padding: 0.4rem 0.5rem; }

/* company sign-in */
.sso-block { margin-top: 1rem; }
.sso-block summary { cursor: pointer; }
.sso-form { margin-top: .6rem; display: grid; gap: .4rem; }
.sso-row { display: flex; gap: .5rem; }
.sso-row input { flex: 1; min-width: 0; }

/* bare layout: sign in, create account, terms, OAuth consent */
body.bare { display: flex; flex-direction: column; min-height: 100vh; }
.bare-top { display: flex; justify-content: center; padding: 1.25rem 1rem 0; }
.bare-top .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: inherit; }
.bare-top .brand span { color: var(--accent); }
.bare-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.bare-main .login-card { margin: 0; }
.bare-foot { display: flex; justify-content: center; gap: 1.25rem; padding: 1rem; font-size: .8rem; }
.bare-foot a { color: var(--muted); text-decoration: none; }
.bare-foot a:hover { color: inherit; }

/* OAuth consent */
.consent-card { max-width: 32rem; text-align: left; }
.consent-apps { display: flex; align-items: center; justify-content: center; gap: .9rem; margin: .25rem 0 1rem; }
.consent-app { width: 4.5rem; height: 4.5rem; border-radius: 1rem; background: var(--bg-alt); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.consent-app img { width: 100%; height: 100%; object-fit: cover; }
.consent-initial { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.consent-arrow { color: var(--muted); font-size: 1.3rem; }
.consent-title { text-align: center; font-size: 1.35rem; font-weight: 500; margin: 0 0 1.25rem; }
.consent-title strong { font-weight: 700; }
.consent-label { margin: 0 0 .35rem; color: var(--muted); font-size: .85rem; }
.consent-table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: .5rem; overflow: hidden; margin-bottom: 1rem; font-size: .92rem; }
.consent-table th, .consent-table td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.consent-table tr:last-child th, .consent-table tr:last-child td { border-bottom: 0; }
.consent-table th { width: 8.5rem; font-weight: 600; white-space: nowrap; }
.consent-table td { word-break: normal; overflow-wrap: anywhere; }
.consent-note { font-size: .9rem; line-height: 1.5; margin: .5rem 0; }
.consent-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

.consent-duration { flex-basis: 100%; text-align: left; margin-bottom: .75rem; }
.consent-duration select { display: block; width: 100%; padding: .65rem; margin-top: .5rem; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: .5rem; font: inherit; }
