:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --text: #18202b;
    --muted: #5f6a79;
    --line: #d8dee8;
    --brand: #0f6d6a;
    --danger: #a61b38;
    --ok: #167a2f;
    --dev: #3269d6;
    --test: #f09b1f;
    --deploy: #3b8f55;
    --done: #2f2f2f;
    --prio-low: #27ae60;
    --prio-med: #3269d6;
    --prio-high: #e67e22;
    --prio-crit: #c0392b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: radial-gradient(circle at 10% 0%, #dfeef6, var(--bg));
    color: var(--text);
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.site-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(248, 251, 253, 0.95) 100%);
    border-bottom: 1px solid #d4dde8;
    box-shadow: 0 8px 28px rgba(24, 42, 66, 0.08);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}


.header-shell {
    padding: 1rem 0 0.95rem;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-lockup {
    display: inline-flex;
    flex-direction: column;
    gap: 0.18rem;
    text-decoration: none;
}

.brand-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b7b8d;
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #163847;
    line-height: 1.1;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.user-meta-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a8797;
}

.main-nav {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    align-items: center;
}

.header-nav-row {
    margin-top: 0.9rem;
    padding: 0.45rem;
    border: 1px solid #d7e0ea;
    border-radius: 16px;
    background: linear-gradient(180deg, #fdfefe 0%, #f4f8fb 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    color: #345466;
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: #edf5f7;
    border-color: #c8d8e2;
    color: #173746;
    text-decoration: none;
}

.nav-link.active {
    background: linear-gradient(135deg, #114f68 0%, #0f6d6a 100%);
    border-color: #114f68;
    color: #fff;
    box-shadow: 0 8px 18px rgba(17, 79, 104, 0.24);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: linear-gradient(180deg, #edf7f5 0%, #e6f2ef 100%);
    color: #18433f;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    border: 1px solid #d3e5df;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.user-name {
    font-size: 0.92rem;
    font-weight: 700;
}

.user-role {
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: rgba(15, 109, 106, 0.12);
    color: #0d5b58;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.notif-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.notif-bell {
    position: relative;
    border: 1px solid #c9d8e4;
    background: #f6fbff;
    color: #193a50;
    border-radius: 999px;
    width: 2.45rem;
    height: 2.45rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.08rem;
    flex: 0 0 auto;
}

.notif-bell:hover {
    background: #eaf5ff;
}

.notif-count {
    position: absolute;
    top: -0.28rem;
    right: -0.3rem;
    min-width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    background: #cf2c2c;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    padding: 0 0.22rem;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    width: 360px;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border: 1px solid #d8e3ee;
    border-radius: 10px;
    box-shadow: 0 18px 36px rgba(16, 36, 52, 0.2);
    padding: 0.7rem;
    z-index: 80;
}

.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    color: #16384e;
}

.notif-head strong {
    display: block;
    min-width: 0;
}

.notif-view-all {
    font-size: 0.82rem;
    margin-left: auto;
    white-space: nowrap;
}

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.28rem;
}

.notif-item {
    display: block;
    color: #1e4158;
    background: #f7fbff;
    border: 1px solid #e0ebf4;
    border-radius: 7px;
    padding: 0.42rem 0.5rem;
    font-size: 0.86rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item:hover {
    background: #eef6ff;
    text-decoration: none;
}

.notif-empty {
    margin: 0.3rem 0 0.2rem;
    font-size: 0.88rem;
}

.guide-link {
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
}

.logout-btn {
    border-color: #f0d6dc;
    color: #8d1d36;
    background: #fff8f9;
}

.logout-btn:hover {
    background: #ffeef1;
}

main {
    padding: 1.5rem 0 3rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.how-panel {
    border-color: #c9dbe9;
    background: linear-gradient(135deg, #f7fbff 0%, #f2fbf8 100%);
}

.how-details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    color: #18354a;
    margin-bottom: 0.55rem;
}

.how-details > summary::-webkit-details-marker {
    display: none;
}

.how-context {
    font-size: 0.85rem;
    color: #35586e;
    background: #e8f3fb;
    border: 1px solid #c8ddef;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
}

.how-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.8rem;
    margin-top: 0.25rem;
}

.how-step {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.how-step p {
    margin: 0;
    font-size: 0.92rem;
    color: #244355;
    line-height: 1.35;
}

.how-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: #0f6d6a;
    margin-top: 0.28rem;
    flex: 0 0 auto;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.cards-4 {
    grid-template-columns: repeat(4, 1fr);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
}

.card p {
    font-size: 2rem;
    margin: 0;
}

.card-overdue p {
    color: var(--danger);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-grid {
    display: grid;
    gap: 0.75rem;
}

.quick-tag-details {
    border: 1px dashed #c6d7e5;
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
    background: #f8fbff;
}

.quick-tag-details > summary {
    cursor: pointer;
    color: #1f4f66;
    font-weight: 600;
}

.quick-tag-form {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.65rem;
}

.quick-tag-grid {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 0.6rem;
    align-items: end;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.95rem;
}

input,
select,
textarea,
button {
    font: inherit;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

button {
    background: var(--brand);
    color: #fff;
    border: none;
    cursor: pointer;
}

button:hover {
    opacity: 0.95;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.6rem;
    border-bottom: 1px solid var(--line);
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.85rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid transparent;
    text-transform: capitalize;
}

.status-pending {
    background: #fff3d6;
    border-color: #f3c86f;
    color: #8a5d00;
}

.status-in-progress {
    background: #eaf4ff;
    border-color: #a9c9f5;
    color: #24539a;
}

.status-completed {
    background: #e8f8ea;
    border-color: #8ecf9d;
    color: #1b7330;
}

.task-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 26, 39, 0.5);
}

.task-modal-dialog {
    position: relative;
    width: min(720px, calc(100vw - 2rem));
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 24px 60px rgba(17, 33, 46, 0.22);
}

.task-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.task-modal-header h3 {
    margin: 0;
}

.metric-pill {
    display: inline-flex;
    min-width: 2rem;
    justify-content: center;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.metric-total {
    background: #e8f1ff;
    color: #1f4e96;
    border-color: #b9d2f5;
}

.metric-completed {
    background: #e7f7ec;
    color: #196637;
    border-color: #b6e0c2;
}

.metric-due {
    background: #fdecef;
    color: #9f1d36;
    border-color: #f3c1cc;
}

.metric-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 0.7rem;
}

.metric-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #3f4f60;
    font-size: 0.85rem;
}

.stage-dev { background: var(--dev); }
.stage-test { background: var(--test); }
.stage-deploy { background: var(--deploy); }
.stage-done { background: var(--done); }
.stage-default { background: #68707c; }

.prio-low { background: var(--prio-low); }
.prio-medium { background: var(--prio-med); }
.prio-high { background: var(--prio-high); }
.prio-critical { background: var(--prio-crit); }

.flash {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    margin-bottom: 0.9rem;
}

.flash-success {
    background: #e8f8ed;
    color: var(--ok);
    border: 1px solid #b5e2bf;
}

.flash-error {
    background: #fdecef;
    color: var(--danger);
    border: 1px solid #f6c2cc;
}

.muted {
    color: var(--muted);
    font-size: 0.92rem;
}

.member-list,
.attachments {
    margin: 0;
    padding-left: 1rem;
}

.login-panel {
    max-width: 480px;
    margin: 2rem auto;
}

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.footer-inner p {
    margin: 0;
}

.update-badge { font-size: 0.8rem; }
.ub-error { background: #c0392b; }
.ub-note { background: #2980b9; }
.ub-resolved { background: #1e8449; }
.ub-partial { background: #d68910; }
.ub-not-error { background: #5d6d7e; }
.ub-dev-note { background: #117864; }
.ub-later { background: #6c5ce7; }
.ub-status { background: #8e44ad; }
.ub-close { background: #27ae60; }
.ub-reopen { background: #e67e22; }
.ub-default { background: #7f8c8d; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.75rem;
}

.section-header h2,
.section-header h1 {
    margin: 0;
}

.view-all { font-size: 0.9rem; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}

.filter-bar label {
    flex: 1 1 160px;
    min-width: 140px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.btn-secondary {
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    color: #20303c;
    border: 1px solid #d5dfe9;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(18, 39, 58, 0.04);
}

.btn-secondary:hover {
    background: #f2f6f9;
    text-decoration: none;
}

.upload-dropzone {
    border: 2px dashed #9cb8d2;
    background: #f7fbff;
    border-radius: 10px;
    padding: 0.85rem;
    color: #2f4a63;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus {
    border-color: #4d89c7;
    background: #eef6ff;
    outline: none;
}

.upload-dropzone.is-drag-over {
    border-color: #1f6fb8;
    background: #e6f2ff;
}

.upload-picked {
    margin-top: -0.35rem;
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
    word-break: break-word;
}

.upload-empty {
    margin: 0;
}

.upload-picked-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.upload-picked-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #eaf3ff;
    border: 1px solid #c4dbf3;
    border-radius: 999px;
    padding: 0.2rem 0.45rem 0.2rem 0.6rem;
    max-width: 100%;
}

.upload-picked-name {
    color: #1f3e58;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-remove-btn {
    border: none;
    background: #d9534f;
    color: #fff;
    border-radius: 999px;
    width: 1.2rem;
    height: 1.2rem;
    line-height: 1;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
}

.upload-remove-btn:hover,
.upload-remove-btn:focus {
    background: #c9302c;
    outline: none;
}

.file-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 22, 34, 0.64);
}

.file-preview-content {
    position: relative;
    z-index: 1;
    width: min(92vw, 920px);
    max-height: 88vh;
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 16px 44px rgba(15, 32, 50, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.file-preview-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    border: none;
    background: transparent;
    color: #2e3f4f;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.file-preview-title {
    margin: 0;
    padding-right: 2rem;
    color: #1f3345;
    font-weight: 600;
    word-break: break-word;
}

.file-preview-image-wrap {
    min-height: 180px;
    height: min(70vh, calc(88vh - 170px));
    max-height: calc(88vh - 170px);
    overflow: hidden;
    background: #f4f8fc;
    border: 1px solid #d3e0ec;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.file-preview-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
    display: block;
}

.file-preview-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-link {
    background: none;
    border: none;
    color: var(--brand);
    cursor: pointer;
    padding: 0;
    font: inherit;
    font-size: 0.9rem;
}

.btn-link:hover { text-decoration: underline; }

.danger-link { color: var(--danger); }
.actions-cell { white-space: nowrap; }
.msg-preview { max-width: 280px; }

.expand-row > td {
    background: #f8faff;
    border-bottom: 2px solid var(--line);
}

.expand-box { padding: 0.75rem; }
.expand-box p { margin: 0.4rem 0; }
.att-list { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.inline-edit-form { padding: 0.75rem; }
.inline-edit-form textarea { width: 100%; }
.edit-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.inline-edit-form select,
.inline-edit-form input[type="file"] { width: 100%; }

.breadcrumb-bar h1 { margin: 0.4rem 0; }
.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
.breadcrumb a { color: var(--brand); }

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-top: 1rem;
    align-items: center;
    border-top: 1px solid var(--line);
    margin-top: 1rem;
}

.page-link {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--brand);
    background: var(--surface);
    font-size: 0.9rem;
    text-decoration: none;
}

.page-link:hover {
    background: var(--bg);
    text-decoration: none;
}

.page-active {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}

.page-gap { color: var(--muted); padding: 0 0.2rem; }
.page-info { margin-left: 0.5rem; }

.row-overdue { background: #fff5f5; }
.row-overdue:hover { background: #ffe9e9; }
.overdue-text { color: var(--danger); }

.progress-wrap { margin-top: 0.75rem; }
.progress-label {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}
.progress-bar {
    height: 10px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.tag-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.82rem;
    margin: 1px 2px;
}

.tag-select-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-check {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.tag-check input[type="checkbox"] {
    margin: 0;
    padding: 0;
    border: none;
    width: auto;
}

.tag-action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.tag-action-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.45rem;
    border: 1px solid #d8e1ea;
    border-radius: 999px;
    background: #f9fbfd;
}

.tag-add-form {
    align-items: center;
    flex-wrap: wrap;
}

.tag-add-form select {
    min-width: 220px;
}

.notif-history {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.notif-history-item {
    border: 1px solid #d9e3ed;
    border-radius: 10px;
    background: #fbfdff;
    padding: 0.65rem 0.75rem;
}

.notif-history-item.unread {
    border-color: #9ec2df;
    background: #eef6ff;
}

.notif-history-title {
    margin: 0;
    color: #17384d;
    font-weight: 700;
    font-size: 0.93rem;
}

.notif-history-meta {
    margin: 0.22rem 0 0;
    font-size: 0.83rem;
    color: #516577;
}

.notif-history-line {
    margin: 0.42rem 0 0;
    color: #244154;
    font-size: 0.9rem;
}

.notif-history-actions {
    margin-top: 0.46rem;
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.chart-panel canvas {
    width: 100% !important;
    max-height: 260px;
}

@media (max-width: 900px) {
    .cards,
    .cards-4,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .header-top {
        flex-direction: column;
        align-items: stretch;
    }

    .main-nav {
        width: 100%;
        justify-content: flex-start;
    }

    .header-user {
        width: 100%;
        justify-content: space-between;
    }

    .user-meta {
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .header-actions .btn-secondary {
        flex: 1 1 auto;
        text-align: center;
    }

    .notif-wrap {
        order: -1;
    }

    .notif-dropdown {
        right: auto;
        left: 0;
        width: min(360px, calc(100vw - 2rem));
    }

    .how-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-tag-grid {
        grid-template-columns: 1fr;
    }
}
