/* apps.besino.xyz — dark, quiet, icon-forward. */
:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --card: #151924;
  --card-2: #1b2030;
  --line: #262c3d;
  --text: #e8ebf3;
  --muted: #8b93a7;
  --accent: #7c9cff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1a2240 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #18142b 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text); font: 15px/1.6 var(--body);
}
a { color: #a9bbff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; flex: 1; }
.inline { display: inline; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1080px; width: 100%; margin: 0 auto; padding: 18px 16px; }
.brand { font-family: var(--display); font-weight: 700; color: var(--text); font-size: 17px; display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, #7c9cff, #c084fc); box-shadow: 0 0 18px #7c9cff88; }
.topbar nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topbar nav a { color: var(--text); }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.linklike:hover { color: var(--text); }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px;
  background: var(--accent); color: #0b0d12; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.footer { text-align: center; padding: 24px 16px 32px; font-size: 13px; }

/* flashes */
.flashes { display: grid; gap: 8px; margin: 0 0 20px; }
.flash { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.flash-success { border-color: #2c6b45; background: #12251b; }
.flash-error { border-color: #7a2f2f; background: #2a1414; }
.flash-info, .flash-warning { border-color: #3a4670; background: #141a2e; }

/* hero + grid */
.hero { padding: 40px 0 32px; max-width: 640px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.lede { color: #b6bdcf; font-size: 17px; margin: 0; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; height: 100%;
  padding: 20px; border-radius: var(--radius); background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line); color: var(--text); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 12px 40px -18px color-mix(in srgb, var(--accent) 70%, transparent); }
.tile .app-icon { margin-bottom: 10px; }
.tile-name { font-family: var(--display); font-weight: 700; font-size: 18px; }
.tile-tag { color: var(--muted); font-size: 14px; line-height: 1.45; }
.tile-meta { margin-top: auto; padding-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.empty, .note { margin-top: 32px; }

/* icons */
.app-icon { width: 56px; height: 56px; border-radius: 16px; flex: none; object-fit: cover;
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.app-icon-mono { display: inline-grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 22px;
  color: #0b0d12; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffffff)); }
.app-icon.lg { width: 88px; height: 88px; border-radius: 24px; font-size: 34px; }
.app-icon.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; box-shadow: none; }

/* pills */
.status, .pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.status-live { color: var(--ok); border-color: #24563a; }
.status-beta { color: #93c5fd; border-color: #29436b; }
.status-dev { color: var(--warn); border-color: #5c4a1c; }
.pill-public { color: var(--ok); border-color: #24563a; }
.pill-members { color: #93c5fd; border-color: #29436b; }
.pill-restricted { color: #c4b5fd; border-color: #45387a; }
.pill-draft { color: var(--muted); border-style: dashed; }
.pill-super { color: #fcd34d; border-color: #6b5518; }

/* app page */
.admin-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px;
  border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; }
.admin-strip .btn { margin-left: auto; }
.app-page { max-width: 820px; }
.back { display: inline-block; color: var(--muted); font-size: 14px; margin: 8px 0 24px; }
.app-head { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 32px; }
.app-head h1 { margin-bottom: 6px; }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 0; }
.prose { color: #c9cfdc; font-size: 16px; line-height: 1.7; }
.prose h2, .prose h3 { margin-top: 1.6em; color: var(--text); }
.prose img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.prose pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; }
.prose code { font-size: .9em; background: var(--card-2); padding: .1em .35em; border-radius: 5px; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.get-it { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 20px; }
.plan { padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.plan h3 { margin: 0; }
.plan .price { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--accent); margin: 2px 0 4px; }
.plan .muted { flex: 1; margin: 0 0 12px; font-size: 14px; }
.plan .btn { align-self: flex-start; }
.form-title { margin: 0 0 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font: 500 14px/1.2 var(--body);
  background: var(--card-2); color: var(--text); border: 1px solid var(--line); cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; border-color: #3a4258; background: #22283a; }
.btn-accent { background: var(--accent); border-color: transparent; color: #0b0d12; font-weight: 600; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 85%, #ffffff); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: #7a2f2f; color: var(--bad); }
.btn-danger:hover { background: #2a1414; border-color: #9b3b3b; }
.btn-small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.right { float: right; }

/* forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.center-card { max-width: 440px; margin: 48px auto; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: #b6bdcf; }
input:not([type=checkbox]):not([type=color]):not([type=file]), textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text); font: 15px/1.4 var(--body); }
textarea { resize: vertical; font-family: var(--body); }
textarea[name=description_md] { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; border-color: transparent; }
input[type=color] { width: 64px; height: 42px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
input[type=file] { color: var(--muted); font-size: 13px; max-width: 100%; }
.hint { font-size: 12px; color: var(--muted); }
.error { font-size: 13px; color: var(--bad); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.row2, .row3 { display: grid; gap: 14px; }
@media (min-width: 700px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; }
}
.row-form { grid-template-columns: 1fr; align-items: end; }
@media (min-width: 800px) { .row-form { grid-template-columns: 1fr 1.4fr auto auto; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.icon-edit { display: flex; gap: 16px; align-items: center; }
.icon-edit > div { display: grid; gap: 6px; min-width: 0; }
.grants { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.grants legend { padding: 0 6px; font-size: 13px; color: #b6bdcf; }
.plan-add { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* admin */
.page-title { font-size: 30px; margin: 16px 0 12px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.on { color: var(--text); border-bottom-color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel h2 { display: flex; align-items: center; gap: 8px; }
.panel h2 .right { margin-left: auto; float: none; }
.count { font-family: var(--body); font-size: 12px; color: var(--muted); background: var(--card-2); padding: 1px 8px; border-radius: 999px; }
.table { width: 100%; border-collapse: collapse; }
.table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .icon-cell { width: 40px; }
.table tr.done { opacity: .5; }
.table .msg { max-width: 360px; white-space: pre-wrap; font-size: 14px; color: #c9cfdc; }
.clamp { max-width: 320px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.mini-grid a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: var(--text); }
.mini-grid a:hover { background: var(--card-2); text-decoration: none; }
.mini-grid .pill { margin-left: auto; }
.note-quote { margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.danger-zone { border-color: #4a2424; }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .app-head { flex-direction: column; gap: 16px; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 10px 0; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 4px 0; }
  .table .actions { text-align: left; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile { padding: 16px; }
  .tile-tag { display: none; }
}

/* view-as preview */
.preview-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: #3b2a06; border-bottom: 1px solid #6b5518; color: #fde68a; font-size: 14px; text-align: center; }
.viewas-form { display: flex; gap: 10px; flex-wrap: wrap; }
.viewas-form select { flex: 1; min-width: 200px; width: auto; }
