/* pauludehn.com private portal - shared styles */
:root {
  --bg: #f4f2ec;
  --panel: #ffffff;
  --panel-2: #faf8f3;
  --ink: #1d2320;
  --muted: #66706a;
  --line: #ddd9cf;
  --line-strong: #bfb9ab;
  --accent: #0f6e56;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ec;
  --amber: #b45309;
  --amber-soft: #fdf1df;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --ok: #1a7f4b;
  --ok-soft: #e3f5ea;
  --info: #1d4ed8;
  --info-soft: #e4ecfd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(29, 35, 32, .08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151a18; --panel: #1e2522; --panel-2: #232b27; --ink: #ecefe9; --muted: #9aa69f;
    --line: #2d3733; --line-strong: #3f4b46; --accent: #4fc3a1; --accent-ink: #0d1a15; --accent-soft: #1b3a31;
    --amber: #f6b25d; --amber-soft: #3a2a12; --danger: #f08b82; --danger-soft: #3d1c19; --ok: #6cd39a; --ok-soft: #173125;
    --info: #8db1ff; --info-soft: #1b2744; --shadow: 0 10px 30px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #151a18; --panel: #1e2522; --panel-2: #232b27; --ink: #ecefe9; --muted: #9aa69f;
  --line: #2d3733; --line-strong: #3f4b46; --accent: #4fc3a1; --accent-ink: #0d1a15; --accent-soft: #1b3a31;
  --amber: #f6b25d; --amber-soft: #3a2a12; --danger: #f08b82; --danger-soft: #3d1c19; --ok: #6cd39a; --ok-soft: #173125;
  --info: #8db1ff; --info-soft: #1b2744; --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.right { text-align: right; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .bar { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 16px; max-width: 1280px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .8rem; letter-spacing: .02em; }
.brand .tag { font-size: .68rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 7px; text-transform: uppercase; letter-spacing: .08em; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; font-size: .9rem; }
.nav a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: .88rem; color: var(--muted); }

/* layout */
.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 16px 60px; }
.wrap.narrow { max-width: 860px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.split.wide { grid-template-columns: 360px minmax(0, 1fr); }
@media (max-width: 860px) { .split, .split.wide { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.sticky { position: sticky; top: 70px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.pad-0 { padding: 0; }
.card h2, .card h3 { margin-top: 0; }
.card .card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.tile { display: block; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--line-strong); }
.tile .icon { font-size: 1.6rem; margin-bottom: 8px; }
.tile h3 { margin-bottom: 4px; }
.tile p { margin: 0; color: var(--muted); font-size: .9rem; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; line-height: 1.2; text-decoration: none; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 9px; font-size: .85rem; }
.btn.lg { padding: 12px 20px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); font: inherit; }
textarea { min-height: 96px; resize: vertical; }
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label, .label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .8rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.check input { width: 17px; height: 17px; }
.search { display: flex; gap: 8px; }
.search .input { flex: 1; }
.kbd { font-family: var(--mono); font-size: .8em; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--panel-2); }

/* tables & lists */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.table tr:hover td { background: var(--panel-2); }
.table .actions { white-space: nowrap; text-align: right; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.item .meta { font-size: .82rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* badges, tabs, pills */
.badge { display: inline-block; font-size: .74rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); font-size: .85rem; cursor: pointer; }
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); font-size: .92rem; }
.notice.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.notice.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.progress { height: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.stat { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat + .muted { font-size: .84rem; }

/* modal & toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 12, .5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: var(--radius); width: min(620px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal.wide { width: min(960px, 100%); }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { margin: 0; }
.modal .body { padding: 16px 18px; overflow: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.toast-host { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); animation: toast-in .2s ease; max-width: 90vw; }
.toast.danger { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* chat */
.chat { display: flex; flex-direction: column; min-height: 60vh; }
.chat .messages { flex: 1; overflow: auto; padding: 8px 2px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.assistant pre { margin: 8px 0; }
.chat .composer { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.chat .composer textarea { min-height: 48px; max-height: 200px; }

/* dropzone */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); background: var(--panel-2); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* file list specifics */
.filerow { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: default; }
.filerow:hover { background: var(--panel-2); }
.filerow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow .name b { font-weight: 550; }
.filerow .ico { font-size: 1.2rem; text-align: center; }
.filerow.arow { grid-template-columns: 20px 24px 1fr auto; padding-top: 5px; padding-bottom: 5px; cursor: pointer; }
.filerow.sel { background: var(--accent-soft); }
.crumbs { display: flex; gap: 4px; flex-wrap: wrap; font-size: .92rem; align-items: center; }
.crumbs a { padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--panel-2); text-decoration: none; }

/* print */
@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
@media (max-width: 640px) {
  .wrap { padding: 14px 12px 48px; }
  .page-head { margin-bottom: 12px; }
  .userbox .name { display: none; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .table.keep-all th, .table.keep-all td { display: table-cell; }
}
