:root {
    --primary: #0f6cbd;
    --primary-dark: #0b4f8a;
    --secondary: #6b7280;
    --success: #1f9d68;
    --danger: #dc4c64;
    --warning: #f4a100;
    --info: #18b7d9;
    --surface: #ffffff;
    --surface-muted: #f5f8fc;
    --border: #dbe4f0;
    --text: #162338;
    --text-soft: #607086;
    --sidebar: #161c26;
    --sidebar-accent: #202a38;
    --sidebar-hover: rgba(255, 255, 255, 0.09);
    --shadow-sm: 0 14px 34px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 22px 50px rgba(15, 23, 42, 0.14);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --sidebar-width: 318px;
    --content-max: 1760px;
}

html,
body {
    font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

body {
    min-width: 320px;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(15, 108, 189, 0.12), transparent 24%),
        radial-gradient(circle at right top, rgba(24, 183, 217, 0.08), transparent 20%),
        linear-gradient(180deg, #f7faff 0%, #eef3f9 100%);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1040;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.4rem 1.1rem 1rem;
    background:
        radial-gradient(circle at top left, rgba(79, 140, 255, 0.14), transparent 22%),
        linear-gradient(180deg, #1c2431 0%, #121821 100%);
    box-shadow: 12px 0 34px rgba(15, 23, 42, 0.18);
    z-index: 1050;
}

.app-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.85rem;
}

.app-sidebar .navbar-brand {
    display: block;
    width: calc(100% - 46px);
    color: #fff;
    white-space: normal;
    flex: 1 1 auto;
    min-width: 0;
}

.app-brand-mark {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.app-brand-title {
    display: block;
    font-size: clamp(1.02rem, 1.05vw, 1.3rem);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.04em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-brand-subtitle {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.22rem 0.62rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #dfe9ff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.app-sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    width: 100%;
}

.app-sidebar .nav-link {
    display: flex !important;
    align-items: center;
    gap: 0.8rem;
    border-radius: 14px;
    margin-bottom: 0.25rem;
    padding: 0.75rem 0.95rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.88) !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link:focus {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
    transform: translateX(4px);
}

.app-sidebar .nav-link.active {
    color: #ffffff !important;
    background-color: var(--primary) !important;
    font-weight: 700;
}

.app-sidebar .nav-link i {
    flex: 0 0 1.35rem;
    text-align: center;
    font-size: 1.05rem;
    color: inherit;
}

.app-sidebar-user-name {
    display: inline-block;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.app-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 64px;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(219, 228, 240, 0.95);
}

.app-topbar-brand {
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.app-topbar-spacer {
    flex: 1 1 auto;
}

.app-content {
    width: 100%;
    max-width: min(100%, var(--content-max));
    margin: 0 auto;
    padding: 1.5rem;
}

.container-fluid {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.row {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

.card {
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 1.5rem;
}

.card-title,
.card-header h5,
.card-header h6 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.card-body {
    min-width: 0;
}

.btn {
    border-radius: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
    min-height: 46px;
    padding: 0.8rem 1.2rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f8cff 100%);
    border-color: transparent;
}

.btn-secondary,
.btn-outline-secondary,
.btn-light {
    border-color: var(--border);
}

.form-control,
.form-select {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    min-height: 52px;
    background: #fff;
    padding: 0.85rem 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(31, 111, 235, 0.65);
    box-shadow: 0 0 0 0.25rem rgba(31, 111, 235, 0.14);
}

.form-label {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.7rem;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
    padding: 0.55rem 0.85rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
}

.table {
    min-width: 640px;
}

.list-group-item {
    border-left: 0;
    border-right: 0;
    border-color: var(--border);
    padding: 1rem 0.2rem;
}

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dropdown-menu {
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.task-card {
    cursor: move;
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 18px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transition: all 0.2s ease;
}

.task-card:hover {
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}

.task-card.priority-urgent {
    border-left-color: #e03131;
}

.task-card.priority-high {
    border-left-color: #f08c00;
}

.task-card.priority-normal {
    border-left-color: #1c7ed6;
}

.task-card.priority-low {
    border-left-color: #6c757d;
}

.task-form-page {
    max-width: 1600px;
}

.task-form-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}

.task-form-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: var(--primary);
}

.task-form-title {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.task-form-subtitle {
    margin: 0.85rem 0 0;
    max-width: 640px;
    color: var(--text-soft);
    font-size: 1rem;
}

.task-form-back {
    background: rgba(255, 255, 255, 0.88);
}

.task-form-card .card-body {
    padding: 2rem;
}

.task-form-section + .task-form-section {
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    padding-top: 2rem;
}

.task-form-section-header {
    margin-bottom: 1.5rem;
}

.task-form-section-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 800;
}

.task-form-section-header p {
    margin: 0;
    color: var(--text-soft);
}

.task-form-textarea {
    min-height: 160px;
    resize: vertical;
}

.task-form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.task-form-check .form-check-input {
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    flex: 0 0 auto;
}

.task-form-check .form-check-label {
    margin: 0;
    font-weight: 700;
}

.task-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 2rem;
}

.task-form-submit {
    min-width: 170px;
}

.task-form-cancel {
    min-width: 140px;
}

.task-guide-stack {
    display: grid;
    gap: 1rem;
    position: sticky;
    top: 1.5rem;
}

.task-guide-card {
    overflow: hidden;
}

.task-guide-overview {
    background: linear-gradient(135deg, #132238 0%, #1f6feb 100%);
    color: #fff;
}

.task-guide-kicker {
    display: inline-block;
    margin-bottom: 0.6rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    opacity: 0.85;
}

.task-guide-overview h3,
.task-guide-header h4 {
    margin: 0;
    font-weight: 800;
}

.task-guide-overview p {
    margin: 0.75rem 0 0;
    color: rgba(255, 255, 255, 0.84);
}

.task-guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.task-guide-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #edf4ff;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.task-guide-grid {
    display: grid;
    gap: 0.85rem;
}

.guide-card {
    border-radius: 18px;
    padding: 1rem 1.05rem;
    border: 1px solid transparent;
}

.guide-card-title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.guide-card-text {
    color: var(--text-soft);
    line-height: 1.5;
    font-size: 0.92rem;
}

.guide-card-low {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.guide-card-normal,
.guide-card-simple {
    background: #eef6ff;
    border-color: #cfe2ff;
}

.guide-card-high {
    background: #fff4e6;
    border-color: #ffd8a8;
}

.guide-card-urgent,
.guide-card-important {
    background: #fff0f0;
    border-color: #ffc9c9;
}

.task-meta-list {
    display: grid;
    gap: 0.9rem;
}

.task-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.task-meta-label {
    color: var(--text-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
}

.kanban-column {
    flex: 0 0 min(320px, 84vw);
    min-width: 280px;
    background: rgba(255, 255, 255, 0.78);
    border-radius: var(--radius-lg);
    padding: 1rem;
    border: 1px solid var(--border);
}

.table-responsive::-webkit-scrollbar,
.kanban-board::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-responsive::-webkit-scrollbar-thumb,
.kanban-board::-webkit-scrollbar-thumb,
.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(96, 112, 134, 0.35);
    border-radius: 999px;
}

.auth-brand-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.auth-brand-mark .app-brand-title {
    color: var(--text);
    font-size: clamp(1.7rem, 2.3vw, 2.2rem);
}

.auth-brand-mark .app-brand-subtitle {
    background: rgba(15, 108, 189, 0.08);
    color: var(--primary-dark);
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid rgba(31, 111, 235, 0.2);
    outline-offset: 2px;
}

@media (max-width: 1199.98px) {
    :root {
        --sidebar-width: 274px;
    }

    .app-content {
        padding: 1.125rem;
    }

    .task-guide-stack {
        position: static;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        width: min(88vw, 340px);
        max-width: 340px;
    }

    .app-shell.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell.sidebar-open .app-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .app-content {
        padding: 1rem;
    }

    .task-form-page {
        max-width: 100%;
    }

    .app-main {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .app-topbar {
        min-height: 60px;
        padding: 0.75rem;
    }

    .app-content {
        padding: 0.875rem;
    }

    .row {
        --bs-gutter-x: 0.875rem;
        --bs-gutter-y: 0.875rem;
    }

    .card,
    .kanban-column,
    .guide-card {
        border-radius: 18px;
    }

    .card-header,
    .card-body,
    .task-form-card .card-body {
        padding: 1rem !important;
    }

    .task-form-hero,
    .task-form-actions,
    .task-guide-header,
    .task-form-check {
        flex-direction: column;
        align-items: stretch;
    }

    .task-form-back,
    .task-form-submit,
    .task-form-cancel,
    .btn.w-100-mobile {
        width: 100%;
    }

    .table {
        min-width: 560px;
    }

    .app-brand-title {
        font-size: 0.94rem;
    }

    .app-brand-subtitle {
        font-size: 0.68rem;
        padding: 0.18rem 0.5rem;
    }

    .app-sidebar .nav-link {
        padding: 0.85rem 0.95rem;
        font-size: 0.96rem;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 0.95rem;
    }

    .app-content {
        padding: 0.72rem;
    }

    .task-form-title {
        font-size: 1.75rem;
    }

    .task-form-subtitle,
    .guide-card-text {
        font-size: 0.9rem;
    }

    .btn {
        width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .task-form-actions > * {
        width: 100%;
    }

    .app-topbar {
        gap: 0.75rem;
    }

    .app-topbar-brand .app-brand-title {
        font-size: 0.92rem;
    }

    .card-header,
    .card-body {
        padding-left: 0.95rem !important;
        padding-right: 0.95rem !important;
    }
}

@media (min-width: 1440px) {
    .app-content {
        padding: 2rem;
    }

    .task-form-page {
        max-width: 1680px;
    }
}

@media (min-width: 1920px) {
    :root {
        --content-max: 2100px;
        --sidebar-width: 320px;
    }

    body {
        font-size: 18px;
    }

    .app-content {
        padding: 2.5rem;
    }

    .card {
        border-radius: 28px;
    }

    .task-form-title {
        font-size: 3.35rem;
    }
}

@media (min-width: 2560px) {
    :root {
        --content-max: 2480px;
        --sidebar-width: 360px;
    }

    body {
        font-size: 20px;
    }

    .app-content {
        padding: 3rem;
    }

    .btn,
    .form-control,
    .form-select {
        min-height: 56px;
    }
}

@media print {
    .app-sidebar,
    .app-sidebar-backdrop,
    .app-topbar,
    .no-print {
        display: none !important;
    }

    .app-main,
    .app-content {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
}
