:root {
    color-scheme: light;
    --brand-primary: #23294f;
    --brand-primary-dark: #1b203f;
    --brand-secondary: #937984;
    --brand-accent: #ea6145;
    --brand-accent-soft: rgba(234, 97, 69, 0.16);
    --brand-soft: #e1d2d3;
    --bg: #f6f3f4;
    --surface: #ffffff;
    --border: #e4d7d8;
    --text: #23294f;
    --muted: #6f6875;
    --accent: var(--brand-accent);
    --accent-soft: var(--brand-accent-soft);
    --success: #2c9d85;
    --danger: #d94848;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: radial-gradient(circle at 0% 0%, rgba(35, 41, 79, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(234, 97, 69, 0.18) 0%, transparent 50%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

.auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    position: relative;
}

.auth-view::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(35, 41, 79, 0.3) 0%, rgba(147, 121, 132, 0.2) 35%, transparent 60%),
        linear-gradient(315deg, rgba(234, 97, 69, 0.22) 15%, transparent 65%);
    opacity: 0.65;
    pointer-events: none;
}

.auth-card {
    width: min(360px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
    padding: 2.25rem 2.5rem;
    background: var(--surface);
    border: 1px solid rgba(35, 41, 79, 0.08);
    border-radius: 18px;
    box-shadow: 0 24px 55px rgba(35, 41, 79, 0.18);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.auth-card h1 {
    margin: 0;
    text-align: center;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.auth-logo {
    width: 240px;
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(35, 41, 79, 0.18));
}

.auth-subtitle {
    margin: 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.35;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(90deg, var(--brand-primary) 0%, #2f335c 55%, var(--brand-secondary) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
    color: #f7f5f6;
    box-shadow: 0 18px 40px rgba(27, 32, 63, 0.35);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-logo {
    width: 112px;
    height: auto;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.32));
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.brand-title {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 0.01em;
}

.brand-tagline {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.75;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.25rem 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(6px);
}

.session-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.session-controls span {
    font-size: 0.85rem;
    opacity: 0.82;
}

.top-bar button {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.top-bar button.secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.nav-button {
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.nav-button.active {
    background: rgba(234, 97, 69, 0.28);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.nav-button:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
}

.nav-button.hidden {
    display: none;
}

select,
input,
textarea,
button {
    font: inherit;
}

select,
input,
textarea {
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(234, 97, 69, 0.18);
}

button {
    border: none;
    background: var(--accent);
    color: #fff;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 12px 24px rgba(234, 97, 69, 0.22);
    border: 1px solid transparent;
}

button.secondary {
    background: none;
    color: var(--accent);
    border: 1px solid var(--accent);
}

button.danger {
    background: var(--danger);
}

button.success {
    background: var(--success);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    filter: brightness(0.96);
    transform: translateY(-1px);
}

button.secondary:hover:not(:disabled) {
    background: rgba(234, 97, 69, 0.08);
}

.workspace {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1280px;
    margin: 0 auto;
}

.page {
    display: none;
    gap: 1rem;
}

.page.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#tasksPage.page.active {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
}

#assignmentPage.page.active {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, rgba(35, 41, 79, 0.35) 0%, rgba(234, 97, 69, 0.4) 100%);
    opacity: 0.65;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--brand-primary);
    font-weight: 600;
}

#newTaskForm {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.task-item:hover,
.task-item.active {
    border-color: var(--accent);
    box-shadow: 0 14px 32px rgba(35, 41, 79, 0.18);
    background: linear-gradient(135deg, rgba(234, 97, 69, 0.08) 0%, rgba(147, 121, 132, 0.08) 100%);
}

.task-item .title {
    font-weight: 600;
}

.task-item .meta {
    display: flex;
    font-size: 0.8rem;
    color: var(--muted);
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.progress-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(35, 41, 79, 0.08);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #f0846c 100%);
}

.detail {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.placeholder {
    color: var(--muted);
    text-align: center;
    margin: auto;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.detail-header h1 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--brand-primary);
}

.status-chip {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(35, 41, 79, 0.12);
    color: var(--brand-primary);
    align-self: flex-start;
}

.status-chip[data-status="approved"] {
    background: rgba(44, 157, 133, 0.16);
    color: var(--success);
}

.status-chip[data-status="awaiting_review"] {
    background: rgba(234, 97, 69, 0.22);
    color: var(--accent);
}

.status-chip[data-status="rejected"] {
    background: rgba(217, 72, 72, 0.18);
    color: var(--danger);
}

.status-chip[data-status="in_progress"] {
    background: rgba(35, 41, 79, 0.18);
    color: #f8f5f5;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.status-chip[data-status="pending"] {
    background: rgba(147, 121, 132, 0.2);
    color: var(--brand-secondary);
}

.status-chip[data-status="draft"] {
    background: rgba(35, 41, 79, 0.14);
    color: #ffffff;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subtask-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subtask-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 20px rgba(27, 32, 63, 0.08);
}

.subtask-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.subtask-header .title-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.subtask-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-list,
.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.92);
}

.comment .meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.attachment-list a {
    text-decoration: none;
    color: var(--accent);
}


.link-button {
    border: none;
    background: none;
    color: var(--accent);
    padding: 0;
    cursor: pointer;
}

.link-button:hover {
    text-decoration: underline;
}
.actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label {
    flex-direction: column;
}

.form-grid button {
    grid-column: 1 / -1;
    justify-self: start;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.6rem;
    text-align: left;
}

.data-table th {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.checkbox {
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
}

.form-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.form-inline input[type="file"] {
    flex: 1;
}

.notifications-panel {
    position: fixed;
    right: 1rem;
    top: 4.5rem;
    width: 320px;
    max-height: 50vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 20;
}

.notifications-panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-item {
    padding: 0.65rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.notification-item.unread {
    background: var(--accent-soft);
    border-color: rgba(234, 97, 69, 0.35);
}

.notification-item time {
    font-size: 0.75rem;
    color: var(--muted);
}

.badge {
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    .detail {
        order: 1;
    }
}

@media (max-width: 768px) {
    .brand-text {
        gap: 0.1rem;
    }

    .brand-title {
        font-size: 0.95rem;
    }

    .brand-tagline {
        display: none;
    }

    .session-controls {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .main-nav {
        gap: 0.35rem;
        padding: 0.2rem 0.3rem;
    }

    .nav-button {
        padding: 0.4rem 0.7rem;
    }

    #tasksPage.page.active,
    #assignmentPage.page.active {
        grid-template-columns: 1fr;
    }

    .notifications-panel {
        width: calc(100% - 2rem);
        right: 1rem;
    }
}
