:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0f172a;
  --primary-contrast: #ffffff;
  --soft: #f8fafc;
  --ok: #dcfce7;
  --ok-text: #166534;
  --warn: #fef3c7;
  --warn-text: #92400e;
  --danger: #fee2e2;
  --danger-text: #991b1b;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 110px; resize: vertical; }
label { display:block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-shell { width: min(100%, 980px); display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.auth-card, .card, .stat-card, .client-card, .file-card, .user-card { background: var(--panel); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card { padding: 28px; }
.brand-row { display:flex; align-items:center; gap:14px; }
.brand-badge { width: 52px; height: 52px; border-radius: 16px; display:grid; place-items:center; background: var(--primary); color: #fff; font-weight: 800; font-size: 22px; }
h1, h2, h3 { margin: 0; }
p { margin: 8px 0 0; color: var(--muted); }
.stack-lg > * + * { margin-top: 16px; }
.stack-md > * + * { margin-top: 12px; }
.top-space { margin-top: 12px; }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer; display:inline-flex; align-items:center; justify-content:center; gap:8px; font-weight: 600; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-secondary { background: var(--soft); color: var(--text); border: 1px solid var(--border); }
.btn-small { padding: 8px 12px; font-size: 14px; }
.full-width { width: 100%; }
.text-link { color: var(--muted); text-decoration: underline; }

.flash { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; }
.flash.success { background: var(--ok); color: var(--ok-text); }
.flash.error { background: var(--danger); color: var(--danger-text); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 360px 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--border); padding: 22px; display:flex; flex-direction:column; gap:18px; }
.sidebar-head { display:flex; flex-direction:column; gap:16px; }
.user-card { padding: 16px; }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.stats-grid { display:grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card { padding: 14px; }
.stat-card span { display:block; font-size: 13px; color: var(--muted); }
.stat-card strong { display:block; margin-top: 8px; font-size: 28px; }
.sidebar-list { display:flex; flex-direction:column; gap: 12px; overflow:auto; }
.client-card { padding: 16px; transition: .2s ease; }
.client-card.active { border-color: var(--primary); background: var(--soft); }
.client-name { font-weight: 700; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.badge { display:inline-flex; align-items:center; padding: 6px 10px; border-radius: 999px; background: var(--soft); color: var(--text); font-size: 12px; font-weight: 700; }
.badge.ok { background: var(--ok); color: var(--ok-text); }
.badge.warn { background: var(--warn); color: var(--warn-text); }
.row { display:flex; align-items:center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content:flex-end; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.space-between { display:flex; justify-content:space-between; align-items:flex-start; }

.main-content { padding: 24px; }
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap: 16px; margin-bottom: 20px; }
.share-box { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; color: var(--muted); }
.content-grid { display:grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.card { padding: 20px; }
.card-head { display:flex; align-items:center; justify-content:space-between; gap: 12px; margin-bottom: 16px; }
.span-2 { grid-column: span 1; }
.span-3 { grid-column: 1 / -1; }
.chat-list { display:flex; flex-direction:column; gap: 12px; max-height: 420px; overflow:auto; }
.chat-row { display:flex; }
.chat-row.own { justify-content:flex-end; }
.chat-bubble { max-width: 80%; padding: 14px 16px; border-radius: 16px; background: var(--soft); }
.chat-bubble.own { background: var(--primary); color: #fff; }
.chat-meta { font-size: 12px; opacity: .7; margin-bottom: 6px; }
.info-list { display:grid; gap: 10px; }
.info-item { padding: 12px 14px; border-radius: 14px; background: var(--soft); display:flex; justify-content:space-between; gap:10px; }
.note-box { margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px dashed var(--border); color: var(--muted); }
.file-card { display:flex; flex-direction:column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; }
.file-card span { color: var(--muted); font-size: 13px; }
.task-list { display:grid; gap: 12px; }
.task-row { display:grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items:center; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: #fff; }
.task-row.done { opacity: .72; }
.task-main strong { display:block; margin-bottom: 4px; }
.task-meta { display:grid; justify-items:end; gap: 4px; color: var(--muted); font-size: 13px; }
.task-toggle-form { margin: 0; }
.check { width: 24px; height: 24px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor:pointer; }
.check.checked { background: var(--primary); border-color: var(--primary); }
.empty-state { background: var(--panel); border:1px solid var(--border); border-radius: 24px; padding: 40px; box-shadow: var(--shadow); }

.modal[hidden] { display:none; }
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-backdrop { position:absolute; inset:0; background: rgba(15, 23, 42, 0.45); }
.modal-panel { position:relative; width:min(100% - 32px, 560px); margin: 6vh auto; background:#fff; border-radius: 24px; padding: 24px; box-shadow: var(--shadow); }
.icon-btn { border:0; background:transparent; font-size: 28px; cursor:pointer; line-height:1; }
.two-col { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
code { background: var(--soft); padding: 2px 6px; border-radius: 8px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .content-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-head { flex-direction: column; }
}

.flash.info { background: #dbeafe; color: #1d4ed8; }
.page-head-actions { display:grid; gap:12px; justify-items:end; }
.share-label { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color: var(--muted); margin-bottom: 8px; }
.share-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.share-box code { display:block; max-width: 100%; overflow-wrap:anywhere; }
.task-card-open { border-left: 4px solid #cbd5e1; }
.task-title-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.task-description { color: var(--muted); line-height: 1.5; }
.task-owner-badge, .deadline-badge, .done-badge { display:inline-flex; align-items:center; padding: 6px 10px; border-radius:999px; font-size:12px; font-weight:700; }
.task-owner-badge.owner-dig { background:#dbeafe; color:#1d4ed8; }
.task-owner-badge.owner-kunde { background:#dcfce7; color:#166534; }
.task-owner-badge.owner-begge { background:#ede9fe; color:#6d28d9; }
.task-owner-badge.owner-afventer-kunde { background:#fef3c7; color:#92400e; }
.task-owner-badge.owner-afventer-mig { background:#fee2e2; color:#991b1b; }
.deadline-badge.none { background:#e2e8f0; color:#475569; }
.deadline-badge.upcoming { background:#e0f2fe; color:#075985; }
.deadline-badge.soon { background:#fef3c7; color:#92400e; }
.deadline-badge.today { background:#fde68a; color:#92400e; box-shadow: inset 0 0 0 1px #f59e0b; }
.deadline-badge.overdue { background:#fee2e2; color:#991b1b; box-shadow: inset 0 0 0 1px #dc2626; }
.done-badge { background: var(--ok); color: var(--ok-text); }
.done-list .task-row { background:#f8fafc; }
@media (max-width: 980px) { .page-head-actions { justify-items:start; width:100%; } }

.task-meta .btn { justify-self:end; }


.inline-form { margin:0; }
.top-space-sm { margin-top: 10px; }
.approval-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.approval-pill { display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; font-size:12px; font-weight:700; background:#eef2f7; color:#475569; }
.approval-pill.ok { background:#dcfce7; color:#166534; }
.approval-note { font-size:12px; color: var(--muted); }
.check.pending { border-color:#86efac; background:#dcfce7; }

.share-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.page-actions-top { justify-content:flex-end; }
.btn-danger { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; }
.btn-danger:hover { background:#fecaca; }



.uploads-section { overflow: hidden; }
.uploads-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items:start; }
.file-card-static { display:flex; height:100%; }
.file-card-main { display:flex; flex-direction:column; gap:4px; min-width:0; }
.file-card-title-row strong { overflow-wrap:anywhere; }
.file-card-actions { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.file-versions { margin-top:10px; }
.file-versions summary { cursor:pointer; font-weight:600; }
.file-version-list { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.file-version-row { display:flex; justify-content:space-between; gap:12px; align-items:center; padding-top:8px; border-top:1px solid #e6eaf2; }

@media (max-width: 720px) {
  .uploads-grid { grid-template-columns: 1fr; }
  .file-version-row { flex-direction:column; align-items:flex-start; }
}
