:root {
  --navy: #031727;
  --navy-2: #06243a;
  --gold: #d6ad5b;
  --gold-dark: #a97827;
  --cream: #f7f1e6;
  --paper: #fffdf8;
  --ink: #18202a;
  --muted: #6c737a;
  --line: #e7ddcd;
  --success: #2f7d5a;
  --warning: #9a6a19;
  --shadow: 0 12px 32px rgba(0,0,0,.13);
}

* { box-sizing: border-box; }
html, body { margin:0; min-height:100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; background: #ede8de; color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; padding-bottom: 86px; }
.topbar { height: 72px; background: linear-gradient(135deg,var(--navy),var(--navy-2)); color:white; display:flex; align-items:center; justify-content:space-between; padding:0 24px; position:sticky; top:0; z-index:20; box-shadow:0 6px 20px rgba(0,0,0,.16); }
.brand { display:flex; align-items:center; gap:12px; font-family: Georgia, serif; letter-spacing:.12em; }
.brand img { width:38px; height:48px; object-fit:contain; }
.user-badge { text-align:right; display:flex; flex-direction:column; }
.user-badge small { color:#d7c8a7; }
.content-wrap { width:min(980px, 100%); margin:0 auto; padding:24px 18px 40px; }
.bottom-nav { position:fixed; left:50%; transform:translateX(-50%); bottom:0; width:min(980px, 100%); height:68px; background:rgba(255,255,255,.96); backdrop-filter: blur(12px); display:flex; justify-content:space-around; align-items:center; border-top:1px solid var(--line); z-index:30; box-shadow:0 -6px 22px rgba(0,0,0,.07); }
.bottom-nav a { font-size:.86rem; color:#72777c; padding:10px 8px; border-radius:10px; }
.bottom-nav a.active { color:var(--navy); font-weight:700; background:#f1eadf; }

.hero-card, .page-card, .detail-card, .form-card { background:var(--paper); border:1px solid var(--line); border-radius:24px; padding:24px; box-shadow:var(--shadow); }
.hero-card { background: radial-gradient(circle at 90% 15%, rgba(214,173,91,.16), transparent 25%), linear-gradient(145deg,var(--navy),#082940); color:white; border-color:#16344a; }
.hero-card.logged-out { text-align:center; min-height:520px; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.hero-card.logged-out img { width:150px; max-height:190px; object-fit:contain; margin-bottom:18px; }
.hero-card h1, .page-card h1, .detail-card h1, .form-card h1 { margin:.15rem 0 .55rem; font-family: Georgia, serif; font-size:clamp(1.8rem,4vw,2.6rem); }
.eyebrow { text-transform:uppercase; letter-spacing:.14em; font-size:.73rem; color:var(--gold-dark); font-weight:800; margin:0; }
.hero-card .eyebrow { color:#e4c98e; }
.subtitle { color:#d8c39c; text-transform:uppercase; letter-spacing:.13em; font-size:.78rem; }
.muted { color:var(--muted); }
.lead { font-size:1.04rem; line-height:1.6; color:#4a5055; }

.section-heading { display:flex; justify-content:space-between; align-items:end; gap:20px; margin:30px 4px 12px; }
.section-heading h2 { margin:0 0 4px; font-size:1.15rem; }
.section-heading p { margin:0; color:var(--muted); font-size:.9rem; }
.section-heading a { color:var(--gold-dark); font-weight:700; font-size:.9rem; }

.task-list { display:grid; gap:12px; }
.task-card { background:var(--paper); border:1px solid var(--line); border-radius:18px; padding:16px; display:grid; grid-template-columns:52px 1fr auto; align-items:center; gap:14px; box-shadow:0 5px 16px rgba(0,0,0,.06); transition:.18s ease; }
.task-card:hover { transform:translateY(-2px); box-shadow:0 9px 22px rgba(0,0,0,.1); }
.task-icon { width:52px; height:52px; border-radius:14px; display:grid; place-items:center; background:#f7eedf; color:var(--gold-dark); font-size:1.45rem; }
.task-main { min-width:0; display:flex; flex-direction:column; gap:3px; }
.task-main strong { font-size:.98rem; }
.task-main span, .task-main small { color:var(--muted); font-size:.82rem; }
.task-status { display:flex; flex-direction:column; text-align:right; gap:4px; }
.task-status span { font-weight:700; font-size:.85rem; }
.task-status small { color:var(--success); font-size:.76rem; }

.page-title-row { display:flex; align-items:center; justify-content:space-between; gap:18px; }
.degree-pill { background:#f0e5d2; color:#79551c; border:1px solid #e1c994; padding:7px 10px; border-radius:999px; font-size:.8rem; font-weight:800; }
.filter-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.filter-button { border:1px solid var(--line); background:white; color:#4d5358; border-radius:999px; padding:8px 13px; }
.filter-button.active { background:var(--navy); color:white; border-color:var(--navy); }

.detail-card { overflow:hidden; }
.detail-hero { height:170px; margin:-24px -24px 24px; background:linear-gradient(145deg,#061b2c,#0d334e); display:grid; place-items:center; }
.detail-symbol { color:var(--gold); font-size:5rem; transform:rotate(45deg); opacity:.88; }
.details-grid { display:grid; grid-template-columns:145px 1fr; gap:12px 18px; padding:18px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.details-grid dt { color:var(--muted); font-weight:700; }
.details-grid dd { margin:0; }
.notice { margin:18px 0; padding:14px 16px; border-radius:14px; background:#f3eee5; border:1px solid var(--line); }
.notice.success { background:#edf7f2; border-color:#c5e3d5; color:#276748; }
.notice.warning { background:#fff7e8; border-color:#edd5a6; color:#7a5316; }
.subheading { margin-top:28px; font-size:1.1rem; }

.brother-list { display:grid; gap:10px; }
.brother-list.large { margin-top:14px; }
.brother-row { background:var(--paper); border:1px solid var(--line); border-radius:15px; padding:12px 14px; display:flex; align-items:center; gap:12px; }
.brother-row > div:last-child { display:flex; flex-direction:column; }
.brother-row small { color:var(--muted); }
.avatar { width:42px; height:42px; border-radius:50%; background:linear-gradient(145deg,#173b55,#0a2031); color:white; display:grid; place-items:center; font-weight:800; }

.primary-button, .secondary-button { display:inline-flex; justify-content:center; align-items:center; border-radius:999px; padding:12px 20px; font-weight:800; border:1px solid transparent; }
.primary-button { background:linear-gradient(180deg,#e4bf73,#c89439); color:#1b1b1b; }
.secondary-button { background:white; color:var(--navy); border-color:#cfa85f; }
.primary-button.full, .secondary-button.full { width:100%; margin-top:10px; }
.primary-button.compact { padding:9px 14px; font-size:.88rem; }

.login-page { min-height:calc(100vh - 120px); display:grid; place-items:center; }
.login-card { width:min(520px,100%); background:linear-gradient(160deg,#031727,#082940); color:white; border-radius:28px; padding:34px; box-shadow:0 18px 40px rgba(0,0,0,.25); text-align:center; }
.login-logo { width:130px; height:165px; object-fit:contain; }
.login-card h1 { font-family:Georgia,serif; letter-spacing:.13em; margin:8px 0; }
.brother-picker { display:grid; gap:10px; margin-top:22px; text-align:left; }
.brother-choice { width:100%; border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.08); color:white; border-radius:15px; padding:13px 15px; display:flex; justify-content:space-between; align-items:center; }
.brother-choice span:first-child { display:flex; flex-direction:column; gap:3px; }
.brother-choice small { color:#d9c8a8; }

.form-card { max-width:700px; margin:auto; }
.form-card label { display:block; margin:16px 0 6px; font-weight:700; }
.form-card input, .form-card textarea, .form-card select { width:100%; border:1px solid #d8cdbb; background:#fffefa; border-radius:12px; padding:11px 12px; }
.form-card textarea { min-height:110px; resize:vertical; }
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-card fieldset { margin:20px 0; border:1px solid var(--line); border-radius:14px; padding:14px; }
.form-card legend { font-weight:800; }
.form-card label.check { display:flex; gap:8px; align-items:center; font-weight:500; margin:8px 0; }
.form-card label.check input { width:auto; }
.empty-state, .centered { text-align:center; padding:26px; background:var(--paper); border:1px dashed #d9c9af; border-radius:18px; color:var(--muted); }

@media (max-width: 700px) {
  .topbar { padding:0 14px; }
  .brand span { font-size:.9rem; }
  .user-badge span { max-width:120px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .content-wrap { padding:16px 12px 34px; }
  .task-card { grid-template-columns:46px 1fr; }
  .task-icon { width:46px; height:46px; }
  .task-status { grid-column:2; text-align:left; flex-direction:row; gap:8px; }
  .details-grid { grid-template-columns:1fr; gap:5px; }
  .details-grid dd { margin-bottom:9px; }
  .two-col { grid-template-columns:1fr; }
  .bottom-nav a { font-size:.72rem; }
}

.login-form { display:grid; gap:6px; margin-top:20px; text-align:left; }
.login-form label { margin-top:10px; font-weight:700; color:#f4ead8; }
.login-form input { width:100%; border:1px solid rgba(255,255,255,.22); background:rgba(255,255,255,.10); color:white; border-radius:12px; padding:12px 13px; outline:none; }
.login-form input::placeholder { color:#b7c0c8; }
.demo-hint { margin:18px 0 0; color:#cbb992; font-size:.82rem; }
.admin-list { display:grid; gap:10px; margin-top:14px; }
.admin-row { background:var(--paper); border:1px solid var(--line); border-radius:16px; padding:14px; display:flex; gap:14px; align-items:center; justify-content:space-between; }
.admin-row-main { display:flex; flex-direction:column; gap:4px; min-width:0; }
.admin-row-main span { color:var(--muted); font-size:.84rem; }
.admin-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.danger-button { display:inline-flex; justify-content:center; align-items:center; border-radius:999px; padding:12px 20px; font-weight:800; border:1px solid #d8aaaa; background:#fff5f5; color:#9b2c2c; }
.danger-button.compact, .secondary-button.compact { padding:9px 14px; font-size:.88rem; }
.admin-dashboard { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.admin-tile { background:var(--paper); border:1px solid var(--line); border-radius:20px; padding:22px; box-shadow:0 5px 16px rgba(0,0,0,.06); display:flex; flex-direction:column; gap:6px; }
.admin-tile strong { font-size:1.1rem; color:var(--navy); }
.admin-tile span { color:var(--muted); }
@media (max-width:700px) {
  .admin-row { align-items:flex-start; flex-direction:column; }
  .admin-actions { width:100%; justify-content:flex-start; }
  .admin-dashboard { grid-template-columns:1fr; }
}
.user-area { display:flex; align-items:center; gap:12px; }
.logout-button { border:1px solid rgba(255,255,255,.22); background:transparent; color:white; border-radius:999px; padding:7px 10px; font-size:.78rem; }
@media (max-width:700px) {
  .user-area { gap:7px; }
  .logout-button { padding:6px 8px; }
}

/* --- v4: presentation + mobile/PWA polish --- */
html { background: var(--navy); }
body {
  background:
    radial-gradient(circle at 50% -20%, rgba(214,173,91,.16), transparent 35%),
    linear-gradient(180deg, #e8e2d7 0%, #f2eee6 38%, #ece6dc 100%);
  min-height:100dvh;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content:"";
  position:fixed; inset:0; pointer-events:none; z-index:-1;
  background-image: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity:.16;
}
.app-shell { min-height:100dvh; padding-bottom:calc(86px + env(safe-area-inset-bottom)); }
.topbar {
  min-height:74px; height:auto;
  padding-top:env(safe-area-inset-top);
  background:linear-gradient(135deg,#02121f 0%,#041d30 55%,#082b43 100%);
  border-bottom:1px solid rgba(214,173,91,.28);
}
.brand-copy { display:flex; flex-direction:column; line-height:1.05; }
.brand-copy strong { font-family:Georgia,serif; font-weight:500; letter-spacing:.15em; }
.brand-copy small { margin-top:4px; color:#d6c9ad; font-size:.59rem; text-transform:uppercase; letter-spacing:.18em; }
.brand img { filter:drop-shadow(0 2px 6px rgba(0,0,0,.28)); }
.user-monogram { width:38px; height:38px; border-radius:50%; display:grid; place-items:center; background:linear-gradient(145deg,#e3bf75,#a97525); color:#061724; font-weight:900; font-size:.78rem; border:1px solid rgba(255,255,255,.28); box-shadow:0 4px 14px rgba(0,0,0,.2); }
.content-wrap { padding-top:22px; }
.hero-card { position:relative; overflow:hidden; min-height:205px; display:flex; align-items:center; padding:30px; }
.hero-card::after { content:""; position:absolute; right:-12px; top:50%; width:180px; height:220px; transform:translateY(-50%); background:url('../images/dannebrog-logo.png') center/contain no-repeat; opacity:.08; filter:grayscale(1) brightness(2); pointer-events:none; }
.hero-card > * { position:relative; z-index:1; }
.hero-card h1 { letter-spacing:.01em; }
.hero-card p:last-child { max-width:520px; color:#e7dbc2; }
.page-card, .detail-card, .form-card { backdrop-filter:blur(8px); }
.page-card { margin-bottom:14px; }
.task-card { border-color:#dfd4c2; }
.task-card:active { transform:scale(.995); }
.task-icon { box-shadow: inset 0 0 0 1px rgba(169,120,39,.08); }
.degree-pill { box-shadow:inset 0 0 0 1px rgba(255,255,255,.35); }
.bottom-nav {
  bottom:0; height:72px; padding-bottom:env(safe-area-inset-bottom);
  background:rgba(255,253,249,.94);
  border-top:1px solid #d9cfbf;
}
.bottom-nav a { min-width:62px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:7px 8px; transition:.16s ease; }
.bottom-nav a.active { background:transparent; color:var(--navy); }
.bottom-nav a.active .nav-icon { background:#efe2ca; color:#9a6a19; transform:translateY(-1px); }
.nav-icon { width:29px; height:25px; border-radius:9px; display:grid; place-items:center; font-size:1.05rem; line-height:1; transition:.16s ease; }
.login-page { min-height:calc(100dvh - 120px); }
.login-card { position:relative; overflow:hidden; border:1px solid rgba(214,173,91,.35); background:radial-gradient(circle at 50% 0%,rgba(214,173,91,.12),transparent 31%),linear-gradient(165deg,#01111d,#05263d 62%,#031727); }
.login-card::before, .login-card::after { content:""; position:absolute; top:0; bottom:0; width:86px; opacity:.11; background:linear-gradient(90deg,transparent,rgba(214,173,91,.8),transparent); }
.login-card::before { left:-50px; transform:skewX(-10deg); }
.login-card::after { right:-50px; transform:skewX(10deg); }
.login-logo { filter:drop-shadow(0 8px 20px rgba(0,0,0,.35)); }
.login-card h1 { font-weight:500; }
.login-form { position:relative; z-index:2; }
.login-form input:focus { border-color:#d5ad5d; box-shadow:0 0 0 3px rgba(214,173,91,.13); }
.primary-button { min-height:46px; box-shadow:0 6px 16px rgba(169,120,39,.22); }
.primary-button:active { transform:translateY(1px); }
.pwa-install-button { position:fixed; right:18px; bottom:calc(84px + env(safe-area-inset-bottom)); z-index:80; border:1px solid rgba(255,255,255,.22); background:#06243a; color:white; border-radius:999px; padding:10px 14px; display:flex; align-items:center; gap:7px; box-shadow:0 9px 26px rgba(0,0,0,.22); font-weight:750; }
.pwa-ios-hint { position:fixed; right:14px; bottom:calc(82px + env(safe-area-inset-bottom)); z-index:80; max-width:250px; background:#06243a; color:#f8f0e1; border:1px solid rgba(214,173,91,.35); border-radius:14px; padding:9px 12px; box-shadow:0 8px 24px rgba(0,0,0,.2); font-size:.76rem; }
.install-note { margin-top:18px; font-size:.78rem; color:#cdbd9d; }

@media (max-width:700px) {
  .topbar { min-height:64px; padding-left:12px; padding-right:10px; }
  .brand img { width:30px; height:40px; }
  .brand-copy strong { font-size:.86rem; }
  .brand-copy small { display:none; }
  .user-monogram { width:34px; height:34px; }
  .user-badge { display:none; }
  .logout-button { font-size:.72rem; padding:6px 9px; }
  .content-wrap { padding-top:14px; }
  .hero-card { min-height:175px; padding:24px 20px; border-radius:20px; }
  .hero-card::after { width:145px; height:175px; right:-20px; }
  .hero-card h1 { font-size:2rem; }
  .page-card, .detail-card, .form-card { border-radius:20px; padding:18px; }
  .section-heading { margin-top:24px; }
  .bottom-nav { height:67px; }
  .bottom-nav a { font-size:.68rem; min-width:52px; padding-left:5px; padding-right:5px; }
  .nav-icon { font-size:1rem; }
  .login-page { min-height:calc(100dvh - 90px); align-items:start; padding-top:18px; }
  .login-card { border-radius:24px; padding:28px 22px 24px; }
  .login-logo { width:112px; height:142px; }
  .login-card h1 { font-size:1.8rem; }
  .pwa-ios-hint { left:12px; right:12px; max-width:none; text-align:center; }
}

@media (display-mode: standalone) {
  .pwa-install-button, .pwa-ios-hint { display:none !important; }
  .topbar { padding-top:max(env(safe-area-inset-top), 6px); }
}

/* --- v5: profile + password --- */
.profile-link { display:flex; align-items:center; gap:10px; color:white; border-radius:999px; padding:3px 5px 3px 3px; }
.profile-link:hover { background:rgba(255,255,255,.06); }
.profile-button { border:1px solid rgba(214,173,91,.38); background:rgba(214,173,91,.08); color:#f4e5c6; border-radius:999px; padding:7px 10px; font-size:.78rem; }
.profile-header { display:flex; gap:18px; align-items:center; }
.profile-header h1 { margin-bottom:.35rem; }
.profile-avatar { width:78px; height:78px; flex:0 0 78px; border-radius:50%; display:grid; place-items:center; background:linear-gradient(145deg,#e2bc6f,#a97525); color:#061724; font-family:Georgia,serif; font-weight:800; font-size:1.35rem; border:3px solid #fff7e8; box-shadow:0 7px 18px rgba(0,0,0,.14); }
.profile-meta { display:flex; flex-wrap:wrap; gap:7px; }
.profile-meta span { border:1px solid #e3d4bb; background:#f7efdf; color:#73511c; border-radius:999px; padding:5px 9px; font-size:.78rem; font-weight:750; }
.profile-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
.profile-form { margin:0; max-width:none; }
.profile-form h2 { margin:.2rem 0 .35rem; font-family:Georgia,serif; font-size:1.55rem; }
.profile-form input:disabled { background:#f1eee8; color:#777; cursor:not-allowed; }
.validation-message { color:#9b2c2c; font-size:.82rem; margin-top:5px; }

@media (max-width:760px) {
  .profile-grid { grid-template-columns:1fr; }
  .profile-header { align-items:flex-start; }
  .profile-avatar { width:62px; height:62px; flex-basis:62px; font-size:1.05rem; }
  .profile-button { display:none; }
  .profile-link { padding-right:0; }
}
