/* =========================================================
   Harkka – designjärjestelmä
   Editorial / lämmin paperi · syvä petrolinvihreä · amber
   ========================================================= */

:root {
    --paper:       #F4F6FA;
    --paper-2:     #E9EEF6;
    --surface:     #FFFFFF;
    --surface-2:   #F2F5FB;
    --ink:         #000129;
    --ink-soft:    #2B2D4A;
    --muted:       #6B6E85;
    --line:        #E2E7F0;
    --line-strong: #CDD5E3;

    --primary:     #008AFC;
    --primary-700: #0A6FD0;
    --primary-300: #7BC2FF;
    --primary-soft:#E4F2FF;

    --accent:      #0AA6BD;
    --accent-soft: #DEF7FB;

    --brand:       #000129;
    --brand-grad:  linear-gradient(134deg, #008AFC, #97F8F4);

    --danger:      #D43A3A;
    --danger-soft: #FBE2E2;

    /* tilavärit */
    --c-todo:    #8A8FA6;
    --c-prog:    #008AFC;
    --c-review:  #E0921F;
    --c-done:    #15B097;

    --radius:    16px;
    --radius-sm: 10px;
    --shadow:    0 1px 2px rgba(0,1,41,.05), 0 8px 24px -12px rgba(0,1,41,.18);
    --shadow-lg: 0 24px 60px -24px rgba(0,1,41,.30);

    --font-display: 'Outfit', system-ui, sans-serif;
    --font-ui:      'Outfit', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
    --paper:       #00021A;
    --paper-2:     #000110;
    --surface:     #070B26;
    --surface-2:   #0D1336;
    --ink:         #EAF0FF;
    --ink-soft:    #BFC6E2;
    --muted:       #868CAC;
    --line:        #1A2148;
    --line-strong: #2B3263;

    --primary:     #2EA0FF;
    --primary-700: #1488EC;
    --primary-300: #6FC0FF;
    --primary-soft:#0E1E48;

    --accent:      #5EE6F2;
    --accent-soft: #08283220;

    --brand:       #000129;
    --brand-grad:  linear-gradient(134deg, #008AFC, #97F8F4);

    --danger:      #FF6B6B;
    --danger-soft: #2A1020;

    --c-todo:    #7E84A6;
    --c-prog:    #2EA0FF;
    --c-review:  #E6A53A;
    --c-done:    #2BD0AE;

    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 12px 30px -16px rgba(0,0,0,.7);
    --shadow-lg: 0 30px 70px -28px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

.ico { width: 1.15em; height: 1.15em; flex: none; }

/* ===================== Sovelluskuori ===================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 268px;
    flex: none;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 6px 8px 22px; }
/* Mask-logo: väri vaihtuu teeman mukaan (valkoinen tummassa, navy vaaleassa) */
.brand-logo-mask {
    display: block; height: 26px; width: 105px;
    background-color: #fff;
    -webkit-mask: url('img/joowa_white.png') left center / contain no-repeat;
            mask: url('img/joowa_white.png') left center / contain no-repeat;
    transition: background-color .25s;
}
[data-theme="light"] .brand-logo-mask { background-color: var(--ink); }
.brand-tag {
    font-size: 13px; font-weight: 700; letter-spacing: .04em;
    color: #7BC2FF; padding-left: 2px;
}
[data-theme="light"] .brand-tag { color: #008AFC; }
.brand-plate {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); border-radius: 13px; padding: 13px 16px;
    box-shadow: var(--brand-grad); position: relative; overflow: hidden;
    box-shadow: 0 8px 22px -12px rgba(0,138,252,.7), inset 0 0 0 1px rgba(255,255,255,.06);
}
.brand-plate::after { content: ""; position: absolute; inset: 0; background: var(--brand-grad); opacity: .14; }
.brand-logo { height: 22px; width: auto; display: block; position: relative; z-index: 1; }
.brand-logo-lg { height: 30px; }

/* varalogo (kirjainmerkki), jos kuva puuttuu */
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: var(--brand); color: #fff;
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; font-size: 21px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 6px 16px -8px var(--primary);
}
.brand-mark-lg { width: 52px; height: 52px; font-size: 28px; border-radius: 15px; }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 13px; border-radius: var(--radius-sm);
    color: var(--ink-soft); font-weight: 600; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.nav-ico { display: grid; place-items: center; color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link:hover .nav-ico { color: var(--ink-soft); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-700); }
.nav-link.is-active .nav-ico { color: var(--primary); }

.sidebar-foot { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }

.theme-toggle {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer;
    color: var(--ink-soft); font-family: var(--font-ui); font-weight: 600; font-size: 13.5px;
    transition: border-color .15s, background .15s;
}
.theme-toggle:hover { border-color: var(--line-strong); }
.theme-ico-dark { display: none; }
[data-theme="dark"] .theme-ico-light { display: none; }
[data-theme="dark"] .theme-ico-dark { display: inline-grid; }
.theme-label { margin-left: auto; color: var(--muted); }

.user-chip { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: none;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
    letter-spacing: .02em;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-admin { background: var(--accent); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--muted); }

.logout {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 600; font-size: 13.5px;
    transition: background .15s, color .15s;
}
.logout:hover { background: var(--danger-soft); color: var(--danger); }

/* ===================== Pääalue ===================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center; gap: 14px;
    padding: 12px 22px; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 40;
}
.menu-btn { display: none; background: none; border: 0; color: var(--ink); cursor: pointer; place-items: center; padding: 4px; }
.menu-btn .ico { width: 24px; height: 24px; }
.topbar-title { display: none; font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Ilmoituskello */
.notif { position: relative; }
.notif-btn { position: relative; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); width: 42px; height: 42px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; transition: border-color .15s, color .15s, background .15s; }
.notif-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.notif-btn .ico { width: 20px; height: 20px; }
.notif-badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 20px; background: var(--brand-grad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); font-family: var(--font-mono); }

.notif-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 360px; max-width: 88vw; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 60; animation: notifIn .16s ease; }
@keyframes notifIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.notif-readall button { background: none; border: 0; color: var(--primary); font-family: var(--font-ui); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 0; }
.notif-readall button:hover { text-decoration: underline; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.notif-item { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); transition: background .12s; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { background: var(--primary-soft); }
.notif-item.is-unread:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface-2)); }
.notif-ico { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.notif-ico .ico { width: 17px; height: 17px; }
.notif-task { background: var(--primary-soft); color: var(--primary); }
.notif-comment { background: var(--accent-soft); color: var(--accent); }
.notif-status { background: var(--accent-soft); color: var(--c-done); }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-msg { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.notif-time { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }

/* Dashboard-banneri uusista ilmoituksista */
.notif-banner { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: var(--radius); margin-bottom: 24px; background: var(--primary-soft); border: 1px solid var(--primary-300); position: relative; overflow: hidden; }
.notif-banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-grad); }
.notif-banner-ico { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--brand-grad); color: #fff; }
.notif-banner-ico .ico { width: 22px; height: 22px; }
.notif-banner-body { flex: 1; min-width: 0; }
.notif-banner-title { font-weight: 800; font-size: 15px; margin: 0 0 6px; }
.notif-banner-list { display: flex; flex-direction: column; gap: 5px; }
.notif-banner-list a { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.notif-banner-list a:hover { color: var(--primary-700); }
.notif-banner-list .nb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex: none; }
.notif-banner-list .notif-time { margin-left: auto; }
.notif-banner-dismiss { background: none; border: 0; color: var(--muted); cursor: pointer; font-weight: 700; font-size: 12.5px; font-family: var(--font-ui); padding: 4px; white-space: nowrap; }
.notif-banner-dismiss:hover { color: var(--ink); }

.content { padding: 40px 48px 80px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ===================== Otsikkoalue ===================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin: 0 0 6px; font-weight: 500; }
.page-title { font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px); font-weight: 600; letter-spacing: -.02em; margin: 0; line-height: 1.08; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13.5px; margin-bottom: 10px; transition: color .15s; }
.back-link:hover { color: var(--ink); }
.head-actions { display: flex; gap: 10px; align-items: center; }

/* ===================== Painikkeet ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-ui); font-weight: 700; font-size: 14px;
    padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    cursor: pointer; transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px -12px var(--primary); }
.btn-primary:hover { background: var(--primary-700); }
.btn-ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: 13px; }

/* ===================== Tilastot ===================== */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 30px; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
}
.stat-num { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-warn .stat-num { color: var(--danger); }
.stat-progress { align-items: center; justify-content: center; text-align: center; gap: 10px; }
.ring {
    --p: 0;
    width: 64px; height: 64px; border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--line) 0);
    display: grid; place-items: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring-val { position: relative; font-weight: 800; font-size: 14px; font-family: var(--font-mono); }

/* ===================== Kanban ===================== */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
.board-col { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 12px; }
.col-title { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.col-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; }
.board-col-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.board-col-body.drag-over { outline: 2px dashed var(--primary-300); outline-offset: 3px; border-radius: var(--radius-sm); }

.tcard {
    display: block; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow);
    transition: transform .12s, box-shadow .12s, border-color .12s; cursor: grab;
}
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.tcard.dragging { opacity: .5; }
.tcard-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 9px; }
.tcard-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; line-height: 1.3; letter-spacing: -.01em; }
.tcard-meta { margin-bottom: 11px; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; }
.tcard-icons { display: flex; gap: 11px; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.tcard-icons span { display: inline-flex; align-items: center; gap: 4px; }
.tcard-icons .ico { width: 14px; height: 14px; }
.board-hint { color: var(--muted); font-size: 12.5px; margin-top: 16px; text-align: center; }

/* ===================== Badget ===================== */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; letter-spacing: .01em; }
.status { color: #fff; }
.status-todo { background: var(--c-todo); }
.status-in_progress { background: var(--c-prog); }
.status-review { background: var(--c-review); }
.status-done { background: var(--c-done); }
.prio { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.prio .dot { width: 7px; height: 7px; border-radius: 50%; }
.prio-low .dot { background: var(--c-done); }
.prio-medium .dot { background: var(--accent); }
.prio-high .dot { background: var(--danger); }
.prio-high { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.chip { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); }

.dl { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; font-family: var(--font-mono); color: var(--muted); }
.dl .ico { width: 14px; height: 14px; }
.dl-soon { color: var(--accent); }
.dl-overdue { color: var(--danger); }
.dl-inline { margin-left: 8px; padding: 1px 8px; border-radius: 20px; background: var(--surface-2); }
.dl-overdue.dl-inline { background: var(--danger-soft); }
.dl-soon.dl-inline { background: var(--accent-soft); }

/* ===================== Kortit ===================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-title { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0 0 16px; letter-spacing: -.01em; }
.count-pill { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; margin-left: auto; }
.muted { color: var(--muted); }

/* ===================== Lomakkeet ===================== */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.form-section { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 8px 0 -2px; padding-top: 8px; border-top: 1px solid var(--line); }
.form-section:first-of-type { border: 0; padding-top: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input[type=text], input[type=email], input[type=password], input[type=url],
input[type=datetime-local], textarea, select {
    width: 100%; font-family: var(--font-ui); font-size: 14.5px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    padding: 11px 13px; transition: border-color .15s, box-shadow .15s; appearance: none;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--primary-300);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23756F63' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 18px; }
.form-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; flex-direction: column; gap: 10px; }

/* Editor */
.editor { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.editor:focus-within { border-color: var(--primary-300); box-shadow: 0 0 0 3px var(--primary-soft); }
.editor-toolbar { display: flex; align-items: center; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-toolbar button { background: none; border: 0; border-radius: 7px; padding: 6px 10px; cursor: pointer; color: var(--ink-soft); font-family: var(--font-ui); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.editor-toolbar button:hover { background: var(--surface); color: var(--ink); }
.editor-toolbar .ico { width: 15px; height: 15px; }
.editor-spacer { flex: 1; }
.editor-preview-btn { color: var(--primary-700) !important; }
.editor textarea { border: 0; border-radius: 0; }
.editor textarea:focus { box-shadow: none; }
.editor-preview { padding: 16px; min-height: 200px; }

/* Linkit & tiedostot lomakkeessa */
.link-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.link-row.existing input { background: var(--surface-2); color: var(--muted); }
.del-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); width: 38px; height: 38px; border-radius: var(--radius-sm); }
.del-check:hover { color: var(--danger); background: var(--danger-soft); }
.del-check input { display: none; }
.del-check input:checked ~ * , .del-check:has(input:checked) { color: var(--danger); }
.del-check.placeholder { visibility: hidden; }
.del-check .ico { width: 16px; height: 16px; }

.file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.file-item .file-name { flex: 1; font-size: 14px; font-weight: 600; }
.file-item > .ico { color: var(--muted); }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary-300); background: var(--primary-soft); }
.dz-ico { color: var(--primary); display: grid; place-items: center; }
.dz-ico .ico { width: 26px; height: 26px; }
.dz-text { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.dz-text strong { color: var(--primary-700); }
.dz-hint { font-size: 12px; color: var(--muted); }
.dz-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dz-files span { font-size: 12.5px; font-weight: 600; background: var(--primary-soft); color: var(--primary-700); padding: 4px 10px; border-radius: 20px; font-family: var(--font-mono); }

/* ===================== Tehtävänäkymä ===================== */
.task-title-row { display: flex; align-items: center; gap: 14px; }
.task-badges { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.task-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.task-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.task-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }

/* Prose (renderöity Markdown) */
.prose { color: var(--ink-soft); line-height: 1.7; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font-display); color: var(--ink); margin: 1.2em 0 .5em; line-height: 1.25; }
.prose h2 { font-size: 21px; } .prose h3 { font-size: 18px; } .prose h4 { font-size: 16px; }
.prose p { margin: 0 0 .9em; }
.prose ul, .prose ol { margin: 0 0 .9em; padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }
.prose a { color: var(--primary-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.prose strong { color: var(--ink); font-weight: 700; }

/* Materiaalit */
.material-group { display: flex; flex-direction: column; gap: 9px; }
.material-group + .material-group { margin-top: 9px; }
.material { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .15s, transform .1s, background .15s; }
.material:hover { border-color: var(--primary-300); transform: translateX(3px); background: var(--surface); }
.material-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.material-link .material-ico { background: var(--primary-soft); color: var(--primary); }
.material-file .material-ico { background: var(--accent-soft); color: var(--accent); }
.material-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.material-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.material-sub { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.material-arrow { color: var(--muted); display: grid; place-items: center; }
.material-arrow .ico { width: 18px; height: 18px; }

/* Keskustelu */
.thread { display: flex; flex-direction: column; gap: 18px; margin-bottom: 22px; }
.comment { display: flex; gap: 12px; }
.comment.is-me { flex-direction: row-reverse; }
.comment-body { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 11px 15px; max-width: 80%; }
.comment.is-me .comment-body { background: var(--primary-soft); border-color: transparent; }
.comment-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.comment.is-me .comment-head { flex-direction: row-reverse; }
.comment-author { font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; }
.tag-mini { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: 5px; }
.comment-time { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.comment-text { font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form .btn { align-self: flex-end; }

/* Tilakortti */
.status-form { display: flex; flex-direction: column; gap: 12px; }
.status-options { display: flex; flex-direction: column; gap: 7px; }
.status-opt { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s; }
.status-opt input { display: none; }
.status-opt::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; transition: background .15s; }
.status-opt-todo::before { background: var(--c-todo); }
.status-opt-in_progress::before { background: var(--c-prog); }
.status-opt-review::before { background: var(--c-review); }
.status-opt-done::before { background: var(--c-done); }
.status-opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.status-opt.is-current { border-color: var(--primary-300); background: var(--primary-soft); }

/* Metakortti */
.meta-card { display: flex; flex-direction: column; }
.meta-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.meta-row:last-child { border-bottom: 0; padding-bottom: 0; }
.meta-row:first-child { padding-top: 0; }
.meta-key { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.meta-key .ico { width: 15px; height: 15px; }
.meta-val { text-align: right; font-weight: 600; font-size: 13.5px; }

/* ===================== Asetukset ===================== */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }

/* ===================== Tyhjä tila ===================== */
.empty { text-align: center; padding: 70px 20px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-mark { font-size: 48px; margin-bottom: 10px; }
.empty h3 { font-family: var(--font-display); font-size: 22px; margin: 0 0 6px; font-weight: 600; }
.empty p { color: var(--muted); margin: 0 0 20px; }

/* ===================== Flash ===================== */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; animation: flashIn .35s ease; }
.flash-success { background: var(--primary-soft); color: var(--primary-700); border-color: var(--primary-300); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ===================== Kirjautuminen ===================== */
/* Koko sivu on yhtenäisesti tumma Joowa-laivastonsininen, kortti kelluu päällä. */
.auth-body { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; margin: 0; position: relative; overflow: hidden; background: #000129; color: #fff; }
.auth-body::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(90% 70% at 95% -10%, rgba(0,138,252,.22), transparent 55%),
        radial-gradient(80% 80% at -10% 115%, rgba(151,248,244,.07), transparent 60%); }
.auth-body.single { grid-template-columns: 1fr; }
.auth-art { position: relative; z-index: 1; background: transparent; color: #fff; overflow: hidden; display: flex; align-items: center; padding: 64px; }
.auth-art-inner { position: relative; z-index: 2; max-width: 440px; }
.auth-logo { height: 34px; width: auto; display: block; margin-bottom: 40px; }
.auth-mark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: rgba(255,255,255,.14); font-family: var(--font-display); font-size: 30px; font-weight: 700; margin-bottom: 36px; backdrop-filter: blur(4px); }
.auth-headline { font-family: var(--font-display); font-size: clamp(38px, 5vw, 54px); line-height: 1.04; font-weight: 700; letter-spacing: -.02em; margin: 0 0 18px; }
.auth-headline .grad { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-sub { font-size: 17px; line-height: 1.6; color: rgba(255,255,255,.82); margin: 0; max-width: 380px; }
.auth-glow { position: absolute; width: 420px; height: 420px; right: -130px; bottom: -150px; border-radius: 50%; background: var(--brand-grad); opacity: .25; filter: blur(24px); z-index: 0; }

.auth-panel { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.auth-panel.wide { width: 100%; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-lg); }
.auth-panel.wide .auth-card { max-width: 540px; }
.auth-card-head { text-align: center; margin-bottom: 24px; }
.auth-card-head .brand-mark { margin: 0 auto 16px; }
.auth-card-head .brand-plate { margin: 0 auto 16px; }
.auth-card-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 0 0 4px; }
.auth-card-head p { color: var(--muted); margin: 0; font-size: 14px; }
.auth-foot { color: rgba(255,255,255,.5); font-size: 12.5px; margin-top: 24px; }

/* ===================== Kirjautumisen taustanimaatio (Joowa-hero: pyörivä 3D-dodekaedri) ===================== */
.auth-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; perspective: 1400px; }

/* Kelluva kehys (jump) */
.dod-frame { position: absolute; inset: 0; animation: dodJump 10s linear infinite; transform-style: preserve-3d; }
@keyframes dodJump { 0% { transform: translateY(-30px); } 50% { transform: translateY(30px); } 100% { transform: translateY(-30px); } }

/* Dodekaedrin sijainnit ja koot */
.dod-wrap { position: absolute; width: 300px; height: 300px; opacity: .24; transform-style: preserve-3d; }
.dod-p1 { top: 6%; right: 9%; }
.dod-p2 { top: -30px; left: 10%; transform: scale(1.55); opacity: .16; }
.dod-p3 { bottom: -40px; right: 33%; transform: scale(.7); opacity: .2; }

/* 3D-dodekaedri */
.dod { position: relative; left: 100px; top: 40px; width: 100px; height: 223px; transform-style: preserve-3d; animation: dodRotate 90s infinite linear; }
.dod-p2 .dod { animation-delay: -8s; }
.dod-p3 .dod { animation-delay: -16s; }
@keyframes dodRotate {
    from { transform: rotateX(0deg)   rotateY(360deg) rotateZ(360deg); }
    to   { transform: rotateX(360deg) rotateY(0deg)   rotateZ(-360deg); }
}

.dod .pent { position: absolute; width: 100px; transform-style: preserve-3d; }
.dod .pent:nth-child(1)  { transform: rotateY(.2turn) translateZ(69px) rotateX(26.5deg); }
.dod .pent:nth-child(2)  { transform: rotateY(.4turn) translateZ(69px) rotateX(26.5deg); }
.dod .pent:nth-child(3)  { transform: rotateY(.6turn) translateZ(69px) rotateX(26.5deg); }
.dod .pent:nth-child(4)  { transform: rotateY(.8turn) translateZ(69px) rotateX(26.5deg); }
.dod .pent:nth-child(5)  { transform: rotateY(1turn)  translateZ(69px) rotateX(26.5deg); }
.dod .pent:nth-child(6)  { bottom: 0; transform: rotateY(.2turn) translateZ(-69px) rotateX(206.5deg); }
.dod .pent:nth-child(7)  { bottom: 0; transform: rotateY(.4turn) translateZ(-69px) rotateX(206.5deg); }
.dod .pent:nth-child(8)  { bottom: 0; transform: rotateY(.6turn) translateZ(-69px) rotateX(206.5deg); }
.dod .pent:nth-child(9)  { bottom: 0; transform: rotateY(.8turn) translateZ(-69px) rotateX(206.5deg); }
.dod .pent:nth-child(10) { bottom: 0; transform: rotateY(1turn)  translateZ(-69px) rotateX(206.5deg); }
.dod .pent:nth-child(11) { transform: translateZ(69px) rotateX(-90deg); }
.dod .pent:nth-child(12) { bottom: 0; transform: translateZ(-69px) rotateX(90deg); }

.dod .pent span { position: absolute; width: 100px; height: 69px; transform-origin: bottom; border-top: 1px solid rgba(255,255,255,.55); }
.dod .pent span:nth-child(1) { transform: rotate(.2turn); }
.dod .pent span:nth-child(2) { transform: rotate(.4turn); }
.dod .pent span:nth-child(3) { transform: rotate(.6turn); }
.dod .pent span:nth-child(4) { transform: rotate(.8turn); }
.dod .pent span:nth-child(5) { transform: rotate(1turn); }

/* Sisääntuloanimaatiot */
.auth-logo, .auth-headline, .auth-sub { opacity: 0; animation: authUp .85s cubic-bezier(.2,.7,.2,1) forwards; }
.auth-logo { animation-delay: .08s; }
.auth-headline { animation-delay: .22s; }
.auth-sub { animation-delay: .38s; }
.auth-card { opacity: 0; animation: authUp .9s cubic-bezier(.2,.7,.2,1) .3s forwards; }
@keyframes authUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* Animoitu liukuväriteksti */
.auth-headline .grad { background: linear-gradient(110deg, #008AFC, #97F8F4, #2EA0FF, #008AFC); background-size: 280% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: gradShift 7s linear infinite; }
@keyframes gradShift { to { background-position: 280% center; } }

/* ---- Moderni hero-typografia ---- */
.auth-art { align-items: center; }
.auth-art-inner { width: 100%; }
.auth-headline { font-size: clamp(54px, 6.8vw, 92px); font-weight: 800; letter-spacing: 0.01em; line-height: .92; margin: 0 0 22px; }
.auth-logo { height: 40px; margin-bottom: 44px; }
.auth-sub { color: rgba(255,255,255,.66); font-size: 17px; }

/* ---- Moderni lasimainen kortti (glassmorphism) ---- */
.auth-card {
    position: relative;
    background: rgba(10, 18, 48, 0.55);
    -webkit-backdrop-filter: blur(28px) saturate(150%);
    backdrop-filter: blur(28px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 24px;
    padding: 46px 42px;
    color: #fff;
    box-shadow: 0 40px 90px -35px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.10);
    transition: box-shadow .4s, border-color .4s;
}
/* Hienovarainen liukuvärireunus */
.auth-card::before {
    content: ""; position: absolute; inset: 0; border-radius: 24px; padding: 1px;
    background: linear-gradient(140deg, rgba(0,138,252,.7), rgba(151,248,244,.25) 40%, transparent 65%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none; opacity: .9; animation: borderGlow 6s ease-in-out infinite;
}
@keyframes borderGlow { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.auth-card:hover { border-color: rgba(255,255,255,.16); box-shadow: 0 50px 110px -40px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.12); }
.auth-card > * { position: relative; z-index: 1; }

/* Logo suoraan tummalle kortille (ei laattaa) */
.auth-card .brand-plate { background: transparent; box-shadow: none; padding: 0; }
.auth-card .brand-plate::after { display: none; }
.auth-card .brand-logo-lg { height: 32px; }

.auth-card-head h2 { color: #fff; font-weight: 700; letter-spacing: -.01em; }
.auth-card-head p { color: rgba(255,255,255,.55); }

/* Kentät */
.auth-card .form { gap: 19px; }
.auth-card .field-label { color: rgba(255,255,255,.74); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.auth-card input[type=text],
.auth-card input[type=email],
.auth-card input[type=password] {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.13);
    color: #fff;
    border-radius: 13px;
    padding: 14px 16px;
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-card input::placeholder { color: rgba(255,255,255,.38); }
.auth-card input:focus {
    outline: none;
    border-color: #2EA0FF;
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px rgba(0,138,252,.22);
}

/* Kenttäikonit */
.auth-card .input-wrap { position: relative; display: block; }
.auth-card .input-ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: rgba(255,255,255,.42); pointer-events: none; transition: color .15s; }
.auth-card .input-wrap input { padding-left: 46px !important; }
.auth-card .input-wrap input:focus ~ .input-ico,
.auth-card .input-wrap:focus-within .input-ico { color: #36A8FF; }

/* Painike: liukuväri + kohoefekti + kiilto */
.auth-card .btn-primary {
    position: relative; overflow: hidden;
    background: linear-gradient(120deg, #008AFC, #36A8FF);
    border: 0; border-radius: 13px; padding: 15px; font-size: 15px; margin-top: 4px;
    box-shadow: 0 14px 34px -12px rgba(0,138,252,.65);
}
.auth-card .btn-primary::after {
    content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
    transform: skewX(-20deg); transition: left .6s ease;
}
.auth-card .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 46px -12px rgba(0,138,252,.9); }
.auth-card .btn-primary:hover::after { left: 130%; }

/* Porrastettu sisääntulo kortin sisällä */
.auth-card-head, .auth-card .field { opacity: 0; animation: authUp .7s cubic-bezier(.2,.7,.2,1) forwards; }
.auth-card-head { animation-delay: .42s; }
.auth-card .field:nth-of-type(1) { animation-delay: .52s; }
.auth-card .field:nth-of-type(2) { animation-delay: .60s; }
.auth-card .btn-primary { opacity: 0; animation: authFadeOnly .7s ease .68s forwards; }
@keyframes authFadeOnly { from { opacity: 0; } to { opacity: 1; } }

/* Flash-viestit tummalla kortilla */
.auth-card .flash-error { background: rgba(255,107,107,.14); border-color: rgba(255,107,107,.38); color: #ffb1b1; }
.auth-card .flash-success { background: rgba(0,138,252,.16); border-color: rgba(0,138,252,.4); color: #a9d8ff; }

/* Asennuslomakkeen osioviivat tummalla */
.auth-card .form-section { color: #fff; border-top-color: rgba(255,255,255,.12); }

.brand-plate { transition: transform .5s ease; }
.auth-card-head:hover .brand-plate { transform: translateY(-2px) scale(1.03); }

@media (prefers-reduced-motion: reduce) {
    .dod-frame, .dod, .auth-card::before,
    .auth-logo, .auth-headline, .auth-sub, .auth-card, .auth-headline .grad,
    .auth-card-head, .auth-card .field, .auth-card .btn-primary { animation: none !important; }
    .auth-logo, .auth-headline, .auth-sub, .auth-card,
    .auth-card-head, .auth-card .field, .auth-card .btn-primary { opacity: 1 !important; }
}

/* ===================== Responsiivisuus ===================== */
@media (max-width: 1080px) {
    .stats { grid-template-columns: repeat(3, 1fr); }
    .board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .form-grid, .task-layout { grid-template-columns: 1fr; }
    .form-side, .task-side { position: static; }
    .auth-body { grid-template-columns: 1fr; }
    .auth-art { display: none; }
}
@media (max-width: 760px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .menu-btn { display: grid; }
    .topbar-title { display: block; }
    .content { padding: 24px 18px 70px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .board { grid-template-columns: 1fr; }
    .page-title { font-size: 27px; }
    .comment-body { max-width: 88%; }
}
