@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    min-height: 100%;
    background: #f4f7fb;
    color: #1f2937;
}

a, .btn-link {
    color: #0b6efd;
}

.btn-primary {
    color: #fff;
    background: #0b6efd;
    border-color: #0b6efd;
}

.app-shell {
    min-height: 100vh;
    padding: 1.25rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.app-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-subtitle {
    color: #64748b;
    font-size: 0.9rem;
}

.app-header-note {
    color: #64748b;
    font-size: 0.95rem;
}

.app-body {
    display: grid;
    gap: 1rem;
}

.app-card {
    border: 1px solid #dbe3ee;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.workspace-shell {
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
    gap: 1rem;
}

.hero-copy,
.hero-card,
.toolbar-panel,
.tree-panel {
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #ffffff;
    padding: 1.25rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.hero-copy h1 {
    font-size: clamp(2rem, 3vw, 3.25rem);
    line-height: 1.05;
    margin: 0.35rem 0 0.75rem;
}

.hero-copy p {
    color: #475569;
    max-width: 58ch;
    margin: 0;
}

.eyebrow {
    color: #0f766e;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-field {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.form-field label {
    color: #334155;
    font-size: 0.92rem;
}

.input,
.select {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #111827;
    border-radius: 10px;
    padding: 0.8rem 0.95rem;
}

.primary-button,
.secondary-button {
    border-radius: 12px;
    padding: 0.8rem 1rem;
    border: 0;
    font-weight: 700;
}

.primary-button {
    width: 100%;
    background: linear-gradient(135deg, #14b37f, #0f8aa7);
    color: white;
}

.secondary-button {
    background: #e2e8f0;
    color: #111827;
}

.message {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    margin-bottom: 0.85rem;
}

.message.ok {
    background: #ecfdf5;
    color: #047857;
}

.message.error {
    background: #fef2f2;
    color: #b91c1c;
}

.loading-state,
.empty-state {
    padding: 1rem;
    color: #64748b;
}

.toolbar-panel {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toolbar-block label {
    display: block;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #475569;
    margin-bottom: 0.45rem;
}

.toolbar-value {
    color: #0f172a;
    font-weight: 600;
    min-height: 1.6rem;
}

.tree-panel {
    padding: 1rem 1.25rem 1.25rem;
    overflow-x: auto;
    --task-row-columns: 1.55rem 1.75rem 1.75rem 3.55rem 2.55rem minmax(2.5rem, 0.45fr) 3.55rem 3.9rem 4.35rem 4.35rem 4.35rem 3.8rem 3.8rem 5.85rem 4rem 3.9rem 2.6rem;
    --task-search-width: 20rem;
    --task-header-columns: 3.55rem 3.9rem 4.35rem 4.35rem 4.35rem 3.8rem 3.8rem 5.85rem 4rem 3.9rem 2.6rem;
}

.tree-root,
.tree-children {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.tree-root {
    width: 100%;
    min-width: 0;
}

.task-column-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.45rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #eef4fb);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
}

.task-column-title {
    font-size: 0.62rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #475569;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-column-righttitles {
    display: grid;
    grid-template-columns: 3.55rem 3.9rem 4.35rem 4.35rem 4.35rem 3.8rem 3.8rem 5.85rem 4rem 3.9rem 2.6rem;
    column-gap: 0.35rem;
    align-items: center;
    margin-left: auto;
    min-width: 0;
}

.task-column-percent,
.task-column-needed,
.task-column-estimate,
.task-column-used,
.task-column-sprint,
.task-column-author,
.task-column-type,
.task-column-status,
.task-column-tags,
.task-column-phase,
.task-column-marked {
    text-align: center;
}

.task-column-name {
    text-align: left;
}

.task-column-search {
    justify-self: start;
    width: min(100%, 36rem);
    min-width: 0;
}

.task-search-box {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.task-search-input {
    width: 100%;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.85rem;
    min-width: 18rem;
}

.task-search-clear {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid #fb7185;
    border-radius: 999px;
    background: #fff1f2;
    color: #be123c;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.task-search-clear:disabled {
    opacity: 0.35;
    cursor: default;
}

.task-search-input::placeholder {
    color: #94a3b8;
}

.tree-children {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    width: 100%;
    min-width: 0;
}

.tree-node {
    margin-top: 0.55rem;
    width: 100%;
    min-width: 0;
}

.node-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.65rem;
    border-radius: 14px;
    border: 1px solid transparent;
    background: #f8fafc;
    min-width: 0;
    width: 100%;
    cursor: pointer;
    box-sizing: border-box;
}

.node-left {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1 1 auto;
    padding-left: calc(var(--tree-depth, 0) * 0.9rem);
}

.node-right {
    display: grid;
    grid-template-columns: 3.55rem 3.9rem 4.35rem 4.35rem 4.35rem 3.8rem 3.8rem 5.85rem 4rem 3.9rem;
    column-gap: 0.35rem;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 0;
}

.node-row:hover {
    border-color: #cbd5e1;
}

.node-row.task-type-task {
    background: #ffffff;
}

.node-row.task-type-chapter {
    background: #eff6ff;
}

.node-row.task-type-other {
    background: #f8fafc;
}

.node-row.selected {
    border: 3px solid #1d4ed8 !important;
    background: #eff6ff;
    box-shadow:
        inset 0 0 0 1px #bfdbfe,
        0 0 0 4px rgba(37, 99, 235, 0.24),
        0 10px 24px rgba(15, 23, 42, 0.12);
    outline: 2px solid #60a5fa;
    outline-offset: -3px;
    position: relative;
    z-index: 1;
}

.node-row.filter-match {
    border-color: #ff4500;
    background: #fff6f0;
    box-shadow:
        inset 0 0 0 1px #ffb38a,
        0 0 0 3px rgba(255, 69, 0, 0.18);
}

.node-row.selected.filter-match {
    border-color: #ff4500 !important;
    box-shadow:
        inset 0 0 0 1px #ffb38a,
        0 0 0 4px rgba(255, 69, 0, 0.18),
        0 10px 24px rgba(15, 23, 42, 0.12);
}

.node-row.filter-inactive {
    opacity: 0.5;
    filter: saturate(0.6);
}

.node-toggle {
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    border-radius: 999px;
    background: #e2e8f0;
    color: #1f2937;
    justify-self: center;
}

.node-spacer {
    width: 1.55rem;
    height: 1.55rem;
    display: inline-block;
    flex: 0 0 auto;
}

.node-icon,
.node-icon-spacer {
    width: 1.55rem;
    height: 1.55rem;
    flex: 0 0 auto;
    display: inline-block;
}

.node-id,
.node-sequence {
    font-size: 1rem;
    font-weight: 700;
    color: #15803d;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.node-sequence {
    min-width: 2.1rem;
}

.node-text {
    min-width: 0;
    width: 14rem;
    max-width: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.node-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-title .task-search-hit {
    padding: 0 0.1rem;
    border-radius: 0.2rem;
    background: #ffd9c9;
    color: #9a3412;
    text-decoration: none;
    font-weight: 800;
}

.node-field {
    min-width: 0;
    text-align: center;
    justify-self: end;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.63rem;
    font-weight: 700;
    color: #000000 !important;
    padding: 0.11rem 0.24rem;
    border-radius: 3px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
}

.sprint-timeline-page .task-graph-node-shell,
.sprint-timeline-page .task-graph-node-row {
    width: 100%;
    min-width: 0;
}

.sprint-timeline-page .task-graph-node-shell {
    align-items: stretch;
}

.sprint-timeline-page .task-graph-node-row {
    gap: 0.15rem;
    align-items: center;
    box-sizing: border-box;
}

.sprint-timeline-page .task-graph-toggle,
.sprint-timeline-page .task-graph-toggle-spacer {
    width: 0.85rem;
    height: 0.85rem;
    flex-basis: 0.85rem;
}

.sprint-timeline-page .task-graph-card {
    flex: 1 1 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    padding: 0.2rem 0.55rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.sprint-timeline-page .task-graph-card .task-graph-title {
    flex: 1 1 0 !important;
    min-width: 0;
    max-width: 100%;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap;
}

.sprint-timeline-page .task-graph-id {
    flex: 0 0 auto;
}

.sprint-timeline-page .task-graph-percent,
.sprint-timeline-page .task-graph-remaining {
    flex: 0 0 auto;
    min-width: 0;
}

.sprint-timeline-page .task-graph-children {
    margin-left: 0.2rem;
    padding-left: 0.3rem;
}

.sprint-timeline-page .sprint-timeline-column-select {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    padding: 0.45rem 0.6rem;
}

.node-type-field {
    background: #ecfeff;
    color: #0f766e;
}

.node-status-field {
    background: #eff6ff;
    color: #1d4ed8;
}

.node-tags-field {
    background: #f8fafc;
    color: #475569;
}

.node-phase-field {
    background: #f8fafc;
    color: #475569;
}

.node-sprint-field {
    background: #fefce8;
    color: #a16207;
}

.node-needed-field {
    background: #ecfccb;
    color: #3f6212;
    text-align: center;
}

.node-percent-field {
    background: #f0fdf4;
    color: #166534;
    text-align: center;
}

.node-estimate-field {
    background: #faf5ff;
    color: #7e22ce;
    text-align: center;
}

.node-used-field {
    background: #fff7ed;
    color: #c2410c;
    text-align: center;
}

.node-author-field {
    background: #f8fafc;
    color: #334155;
    text-align: left;
}

.node-marked-field {
    background: transparent;
    border-color: transparent;
}

.node-marked-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 999px;
    background: #dcfce7;
    border: 1px solid #22c55e;
    color: #166534;
    font-weight: 800;
    font-size: 0.7rem;
    line-height: 1;
}

.task-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.task-editor-shell {
    width: min(90vw, 100%);
    height: 95vh;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.32);
    overflow: hidden;
}

.task-editor-header {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #dbe3ee;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.task-editor-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.task-editor-title > span:first-child {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.task-editor-subtitle {
    color: #64748b;
    font-size: 0.9rem;
}

.task-editor-close {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 1.25rem;
    line-height: 1;
}

.task-editor-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.task-editor-scroll {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
    padding: 1rem 1.25rem 0;
}

.task-editor-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem 1.1rem;
    border-top: 1px solid #dbe3ee;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), #ffffff);
    backdrop-filter: blur(6px);
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.field {
    display: grid;
    gap: 0.35rem;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 0.9rem;
    color: #334155;
}

.editor-frame {
    min-width: 0;
}

.editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.editor-debug-panel {
    margin-top: 0.9rem;
    padding: 0.9rem 1rem;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    background: #fff5f5;
}

.editor-debug-title {
    font-weight: 700;
    color: #991b1b;
    margin-bottom: 0.5rem;
}

.editor-debug-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: #7f1d1d;
    font-size: 0.84rem;
}

.app-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: min(32rem, calc(100vw - 2rem));
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
    animation: toast-slide-in 160ms ease-out;
}

.app-toast.success {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}

.app-toast.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.app-toast-close {
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
}

@keyframes toast-slide-in {
    from {
        transform: translateY(-0.35rem);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.session-summary {
    width: 100%;
}

.session-pill {
    display: inline-block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #0f766e;
    margin-bottom: 0.5rem;
}

.session-subtitle {
    color: #64748b;
    margin-bottom: 1rem;
}

.auth-gate {
    min-height: calc(100vh - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-gate-panel {
    width: min(28rem, 100%);
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #ffffff;
    padding: 1.25rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.auth-gate-panel h1,
.projects-toolbar h1 {
    margin: 0.35rem 0 0.4rem;
    font-size: 1.6rem;
    line-height: 1.1;
}

.page-kicker {
    color: #0f766e;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.tasks-page,
.projects-page {
    display: grid;
    gap: 1rem;
}

.projects-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.projects-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-button,
.danger-button,
.primary-button {
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: 0.55rem 0.8rem;
    font-weight: 600;
    background: #ffffff;
    color: #0f172a;
}

.danger-button {
    border-color: #fecaca;
    color: #b91c1c;
}

.projects-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.projects-list-panel,
.projects-detail-panel {
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #ffffff;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.panel-header,
.button-row,
.authors-area {
    display: flex;
    gap: 0.75rem;
}

.panel-header {
    margin-bottom: 0.75rem;
}

.button-row {
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #111827;
    border-radius: 3px;
    padding: 0.75rem 0.9rem;
}

.projects-grid-wrap {
    overflow: auto;
    max-height: calc(100vh - 14rem);
}

.projects-grid,
.authors-table {
    width: 100%;
    border-collapse: collapse;
}

.projects-grid th,
.projects-grid td,
.authors-table th,
.authors-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 0.6rem 0.55rem;
    text-align: left;
    vertical-align: middle;
}

.projects-grid tbody tr:hover {
    background: #f8fafc;
    cursor: pointer;
}

.projects-grid tbody tr.selected {
    background: #eff6ff;
}

.project-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 3px;
    background: #f8fafc;
    border: 1px solid #dbe3ee;
}

.project-hero {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-icon-box {
    width: 84px;
    height: 84px;
    border: 1px solid #dbe3ee;
    border-radius: 3px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.project-icon-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-meta {
    min-width: 0;
    flex: 1 1 auto;
}

.project-meta h2 {
    margin: 0.25rem 0 0.3rem;
    font-size: 1.3rem;
}

.project-subtitle {
    color: #64748b;
    font-size: 0.9rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1.5fr 0.7fr 0.8fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-field {
    align-self: end;
}

.checkbox-field label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #334155;
    font-weight: 600;
}

.authors-area {
    align-items: flex-start;
    gap: 1rem;
}

.authors-panel {
    flex: 1 1 auto;
    min-width: 0;
}

.author-link-panel {
    width: 15rem;
    display: grid;
    gap: 0.75rem;
}

.panel-title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.icon-button.danger {
    border: 1px solid #fecaca;
    border-radius: 3px;
    background: #fff5f5;
    color: #b91c1c;
    padding: 0.35rem 0.55rem;
}

.hidden-file-input {
    display: none;
}

@media (max-width: 900px) {
    .hero-panel,
    .toolbar-panel {
        grid-template-columns: 1fr;
    }

    .projects-layout,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .authors-area,
    .projects-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.5rem;
        top: 0.5rem;
    }
