:root {
    --app-bg: #f5f7fb;
    --app-card: #ffffff;
    --app-text: #1f2937;
    --app-muted: #6b7280;
    --app-border: #e5e7eb;
    --app-sidebar: #0d172a;
    --app-sidebar-soft: #15223b;
    --app-accent: #3257ff;
    --app-accent-2: #6b7cff;
    --app-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

[data-bs-theme="dark"] {
    --app-bg: #0b1120;
    --app-card: #111a2e;
    --app-text: #e5e7eb;
    --app-muted: #94a3b8;
    --app-border: #22304a;
    --app-sidebar: #08101f;
    --app-sidebar-soft: #111d34;
    --app-shadow: 0 12px 36px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { text-decoration: none; }
.min-w-0 { min-width: 0; }

.app-shell { min-height: 100vh; }
.sidebar {
    width: 268px;
    position: fixed;
    inset: 0 auto 0 0;
    background:
        radial-gradient(circle at 30% 0%, rgba(74, 98, 255, .26), transparent 28%),
        linear-gradient(180deg, var(--app-sidebar), #09111f);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    z-index: 1030;
    border-right: 1px solid rgba(255,255,255,.05);
}
.brand {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 24px;
}
.brand:hover { color: #fff; }
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--app-accent), var(--app-accent-2));
    box-shadow: 0 10px 24px rgba(50,87,255,.35);
    font-size: 1.25rem;
}
.brand strong { display: block; font-size: .98rem; letter-spacing: .01em; }
.brand small { color: #95a3bd; font-size: .74rem; }

.sidebar-nav { display: grid; gap: 6px; }
.sidebar-nav a {
    color: #aebbd0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    transition: .18s ease;
    font-weight: 600;
    font-size: .92rem;
}
.sidebar-nav a i { font-size: 1.05rem; width: 20px; }
.sidebar-nav a:hover, .sidebar-nav a.active {
    color: #fff;
    background: var(--app-sidebar-soft);
    transform: translateX(2px);
}
.sidebar-nav a.active {
    box-shadow: inset 3px 0 0 #7285ff;
}
.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.05);
}
.sidebar-user small { color: #95a3bd; }
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #5068ff, #8c65ff);
    color: #fff;
    font-weight: 800;
}

.main { min-height: 100vh; margin-left: 268px; }
.topbar {
    height: 78px;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: color-mix(in srgb, var(--app-bg) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--app-border);
}
.topbar h1 { margin: 0; font-size: 1.18rem; font-weight: 800; }
.topbar-subtitle { color: var(--app-muted); font-size: .78rem; margin-top: 2px; }
.content { padding: 26px 28px 40px; }

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: var(--app-card);
    color: var(--app-text);
    border: 1px solid var(--app-border);
}
.btn-icon:hover { background: var(--app-bg); color: var(--app-text); }

.app-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: var(--app-shadow);
}
.app-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--app-border);
    padding: 18px 20px;
}
.app-card .card-body { padding: 20px; }

.metric-card {
    height: 100%;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.metric-card::after {
    content: "";
    position: absolute;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    right: -34px;
    top: -34px;
    background: rgba(50,87,255,.07);
}
.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: rgba(50,87,255,.1);
    color: var(--app-accent);
    font-size: 1.15rem;
}
.metric-label { color: var(--app-muted); font-size: .83rem; margin-top: 14px; }
.metric-value { font-size: 1.8rem; font-weight: 800; line-height: 1.15; margin-top: 2px; }

.table-app { --bs-table-bg: transparent; margin-bottom: 0; }
.table-app th {
    color: var(--app-muted);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .035em;
    font-weight: 700;
    border-bottom-color: var(--app-border);
    white-space: nowrap;
}
.table-app td { vertical-align: middle; border-bottom-color: var(--app-border); }
.table-app tbody tr:last-child td { border-bottom: 0; }

.badge-soft {
    border-radius: 999px;
    padding: .42rem .65rem;
    font-size: .72rem;
    font-weight: 700;
}
.task-title { color: var(--app-text); font-weight: 750; }
.task-title:hover { color: var(--app-accent); }
.muted { color: var(--app-muted); }

.form-control, .form-select, .input-group-text {
    border-color: var(--app-border);
    background-color: var(--app-card);
    color: var(--app-text);
    border-radius: 11px;
    min-height: 43px;
}
.form-control:focus, .form-select:focus {
    border-color: #7f91ff;
    box-shadow: 0 0 0 .2rem rgba(50,87,255,.12);
    background-color: var(--app-card);
    color: var(--app-text);
}
textarea.form-control { min-height: 140px; }
.form-label { font-weight: 700; font-size: .85rem; }
.form-text { color: var(--app-muted); }

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .form-control, .filter-bar .form-select { min-width: 150px; }

.timeline { display: grid; gap: 14px; }
.timeline-item {
    position: relative;
    padding-left: 24px;
}
.timeline-item::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    position: absolute;
    left: 0;
    top: 6px;
    background: var(--app-accent);
    box-shadow: 0 0 0 5px rgba(50,87,255,.1);
}
.timeline-item::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 18px;
    width: 1px;
    height: calc(100% + 4px);
    background: var(--app-border);
}
.timeline-item:last-child::after { display: none; }

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    background: #09111f;
}
.login-visual {
    position: relative;
    overflow: hidden;
    padding: 56px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 15%, rgba(86,103,255,.35), transparent 28%),
        radial-gradient(circle at 90% 85%, rgba(121,74,255,.25), transparent 24%),
        linear-gradient(145deg, #0a1530, #08101f);
}
.login-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 34px 34px;
}
.login-copy { position: relative; z-index: 1; max-width: 590px; }
.login-copy h2 { font-weight: 850; font-size: clamp(2.1rem, 4.2vw, 4rem); letter-spacing: -.04em; line-height: 1.03; }
.login-copy p { color: #a9b5c9; max-width: 500px; font-size: 1.03rem; }
.feature-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.feature-pills span {
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 999px;
    background: rgba(255,255,255,.04);
    color: #cad4e4;
    font-size: .82rem;
}
.login-form-area {
    background: var(--app-bg);
    display: grid;
    place-items: center;
    padding: 30px;
}
.login-box { width: min(420px, 100%); }
.login-box .app-card { padding: 28px; }
.login-logo {
    width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
    color: white; background: linear-gradient(135deg, #3257ff, #6c5cff);
    box-shadow: 0 12px 30px rgba(50,87,255,.28); font-size: 1.25rem;
}

#calendar { min-height: 650px; }
.fc .fc-toolbar-title { font-size: 1.1rem !important; font-weight: 800; }
.fc .fc-button {
    border-radius: 10px !important;
    background: var(--app-card) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
    box-shadow: none !important;
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--app-accent) !important;
    color: #fff !important;
}
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--app-border) !important; }
.fc .fc-daygrid-day-number { color: var(--app-text); }
.fc .fc-col-header-cell-cushion { color: var(--app-muted); }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: .22s ease; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .content { padding: 20px 16px 34px; }
    .topbar { padding: 0 16px; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
}

/* v2 workspace polish */
.sidebar-section-label {
    padding: 0 12px 8px;
    color: #66758e;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .12em;
}
.sidebar-user { padding: 0; overflow: hidden; }
.sidebar-user-link { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px; color: #fff; }
.sidebar-user-link:hover { color: #fff; background: rgba(255,255,255,.035); }
.user-chevron { margin-left: auto; color: #6f7e97; font-size: .8rem; }
.avatar-image { object-fit: cover; border: 1px solid rgba(255,255,255,.14); }

.board-hero {
    min-height: 164px;
    border-radius: 24px;
    padding: 28px 30px;
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    color: #fff;
    background:
        radial-gradient(circle at 82% 15%, rgba(255,255,255,.2), transparent 20%),
        radial-gradient(circle at 10% 100%, rgba(119,131,255,.42), transparent 34%),
        linear-gradient(120deg, #13224a 0%, #2e43b8 54%, #6954e8 100%);
    box-shadow: 0 18px 50px rgba(41,63,160,.22);
    overflow: hidden;
    position: relative;
}
.board-hero::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
    right: -70px;
    top: -110px;
}
.board-hero > * { position: relative; z-index: 1; }
.board-hero .eyebrow { font-size: .69rem; letter-spacing: .12em; font-weight: 800; color: #cbd4ff; margin-bottom: 8px; }
.board-hero h2 { font-size: clamp(1.35rem, 2.3vw, 2.15rem); font-weight: 850; letter-spacing: -.035em; margin-bottom: 7px; }
.board-hero p { color: #d6dcf7; margin: 0; max-width: 650px; }

.kanban-shell {
    display: grid;
    grid-template-columns: repeat(4, minmax(285px, 1fr));
    gap: 16px;
    align-items: start;
    overflow-x: auto;
    padding: 2px 2px 18px;
}
.kanban-column {
    min-width: 285px;
    background: color-mix(in srgb, var(--app-card) 70%, var(--app-bg));
    border: 1px solid var(--app-border);
    border-radius: 18px;
    padding: 12px;
}
.kanban-column-head { padding: 6px 5px 12px; }
.kanban-column-head strong { font-size: .9rem; }
.kanban-column-head small { color: var(--app-muted); display: block; margin-top: 3px; font-size: .72rem; }
.kanban-count {
    min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
    background: var(--app-card); border: 1px solid var(--app-border); color: var(--app-muted); font-size: .7rem; font-weight: 800;
}
.kanban-list { display: grid; gap: 10px; min-height: 150px; }
.kanban-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 15px;
    padding: 14px;
    box-shadow: 0 6px 20px rgba(15,23,42,.045);
    cursor: grab;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, opacity .15s ease;
}
.kanban-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--app-accent) 38%, var(--app-border)); box-shadow: 0 11px 28px rgba(15,23,42,.08); }
.kanban-card:active { cursor: grabbing; }
.kanban-locked { cursor: default; opacity: .78; }
.kanban-card-title { display: block; color: var(--app-text); font-weight: 800; font-size: .92rem; line-height: 1.36; margin: 10px 0 6px; }
.kanban-card-title:hover { color: var(--app-accent); }
.kanban-card-desc { color: var(--app-muted); font-size: .77rem; line-height: 1.48; margin-bottom: 12px; }
.kanban-card-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--app-muted); font-size: .72rem; padding: 9px 0; border-top: 1px solid var(--app-border); }
.kanban-card-footer { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding-top: 8px; }
.priority-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 4px rgba(100,116,139,.08); }
.priority-low { background: #25a56a; }
.priority-medium { background: #3972ff; }
.priority-high { background: #f59e0b; }
.priority-urgent { background: #ef4444; }
.kanban-empty { border: 1px dashed var(--app-border); color: var(--app-muted); border-radius: 13px; padding: 13px; text-align: center; font-size: .74rem; opacity: .5; }
.kanban-ghost { opacity: .28; border: 1px dashed var(--app-accent); }
.kanban-chosen { box-shadow: 0 16px 38px rgba(50,87,255,.16); }
.kanban-saving { opacity: .6; pointer-events: none; }

.upload-zone {
    border: 1.5px dashed var(--app-border);
    border-radius: 16px;
    padding: 20px;
    background: color-mix(in srgb, var(--app-bg) 55%, var(--app-card));
    text-align: center;
}
.upload-zone i { font-size: 1.65rem; color: var(--app-accent); }
.upload-zone .form-control { margin-top: 12px; }

.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.attachment-card { border: 1px solid var(--app-border); background: var(--app-card); border-radius: 14px; overflow: hidden; }
.attachment-preview { aspect-ratio: 16/10; background: var(--app-bg); display: grid; place-items: center; overflow: hidden; }
.attachment-preview img { width: 100%; height: 100%; object-fit: cover; }
.attachment-preview i { font-size: 2rem; color: var(--app-muted); }
.attachment-info { padding: 10px; }
.attachment-name { color: var(--app-text); font-size: .78rem; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.profile-hero {
    position: relative;
    min-height: 175px;
    border-radius: 22px;
    background: linear-gradient(120deg,#14234b,#4255c9 60%,#7655dc);
    overflow: hidden;
    margin-bottom: 70px;
}
.profile-hero::after { content:""; position:absolute; width:280px; height:280px; border:1px solid rgba(255,255,255,.15); border-radius:50%; right:-70px; top:-120px; }
.profile-avatar-wrap { position:absolute; left:26px; bottom:-54px; display:flex; align-items:end; gap:16px; z-index:2; }
.profile-avatar {
    width: 108px; height: 108px; border-radius: 28px; object-fit: cover; display:grid; place-items:center;
    border: 5px solid var(--app-bg); background: linear-gradient(135deg,#5068ff,#8c65ff); color:white; font-size:2rem; font-weight:850;
    box-shadow: 0 12px 34px rgba(0,0,0,.18);
}
.profile-identity { padding-bottom: 8px; color: white; }
.profile-identity h2 { margin:0; font-weight:850; }
.profile-identity p { margin:2px 0 0; color:#d7def7; }

.member-card { height:100%; padding:18px; }
.member-card-top { display:flex; align-items:center; gap:12px; }
.member-card .avatar { width:48px; height:48px; border-radius:14px; flex:0 0 auto; }

@media (max-width: 767.98px) {
    .board-hero { padding: 22px; align-items: start; flex-direction: column; }
    .kanban-shell { grid-template-columns: repeat(4, 280px); }
    .profile-avatar-wrap { left:18px; bottom:-58px; }
    .profile-avatar { width:96px; height:96px; }
}
