@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #eef3fb;
    --card: rgba(255, 255, 255, 0.92);
    --card-strong: #ffffff;
    --border: #dfe7f3;
    --text: #16233a;
    --muted: #6f7f98;
    --navy: #0f1b34;
    --navy-2: #16284a;
    --blue: #4f6df7;
    --blue-dark: #3552dd;
    --cyan: #4ad0d5;
    --green: #18a87f;
    --orange: #d9892e;
    --shadow: 0 18px 50px rgba(25, 46, 92, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top right, #f7fbff 0%, var(--bg) 42%, #edf1f9 100%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
body.modal-open { overflow: hidden; }

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

.sidebar {
    width: 230px;
    min-width: 230px;
    background: linear-gradient(180deg, var(--navy) 0%, #13213f 100%);
    color: #d7e3f9;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}

.brand-block {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 8px 12px 24px;
}
.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    box-shadow: 0 10px 24px rgba(79, 109, 247, 0.35);
}
.brand-block h2 {
    margin: 0 0 5px;
    color: white;
    font-size: 24px;
}
.brand-block p {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    color: #9db0d2;
}

.nav-section-title {
    padding: 10px 12px;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    font-size: 11px;
    font-weight: 800;
    color: #8094ba;
}
.nav-section-title.with-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}
.nav-section-title.with-count b {
    color: #bfd2ff;
}

.nav-link {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: #d2dcef;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
    text-align: left;
}
.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(173, 196, 255, 0.16);
    color: white;
}
.nav-icon {
    width: 24px;
    text-align: center;
    color: #8fb1ff;
}

.sidebar-card {
    margin-top: auto;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-card-icon {
    min-width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
}
.sidebar-card strong {
    display: block;
    color: white;
    margin-bottom: 4px;
}
.sidebar-card small {
    color: #a9bad8;
    line-height: 1.45;
}

.main-area {
    flex: 1;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 82px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(215, 225, 240, 0.85);
}
.topbar-left { min-width: 0; }
.breadcrumb {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: #8fa0ba;
    margin-bottom: 6px;
}
.breadcrumb span { margin: 0 8px; }
.topbar-title {
    font-size: 18px;
    font-weight: 800;
    color: #243655;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(24, 168, 127, 0.12);
    color: #0b7f5e;
    font-size: 12px;
    font-weight: 700;
}
.live-badge i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1fd58b;
    display: inline-block;
}

.main-content {
    padding: 20px;
}

.hero-card,
.panel,
.metric-card,
.modal-card {
    background: var(--card);
    border: 1px solid rgba(222, 231, 243, 0.85);
    box-shadow: var(--shadow);
}

.hero-card {
    border-radius: 24px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(79, 109, 247, 0.08), rgba(74, 208, 213, 0.05) 42%, rgba(255, 255, 255, 0.95) 85%);
}
.eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
    color: #5d73d9;
    margin-bottom: 10px;
}
.hero-card h1 {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -1.5px;
}
.hero-card h1 span { color: var(--blue); }
.hero-card p {
    margin: 0;
    color: var(--muted);
    max-width: 720px;
    line-height: 1.6;
}
.hero-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.hero-date {
    padding: 12px 16px;
    border-radius: 14px;
    background: white;
    border: 1px solid var(--border);
    color: #566884;
    font-size: 13px;
    font-weight: 700;
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    transition: all 0.2s ease;
}
.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--blue), #6883ff);
    box-shadow: 0 10px 22px rgba(79, 109, 247, 0.24);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--blue-dark), var(--blue)); }
.btn-secondary {
    color: #44546f;
    background: white;
    border: 1px solid var(--border);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.metric-card {
    border-radius: 20px;
    padding: 14px;
}
.metric-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.metric-label {
    font-size: 12px;
    color: #7c8ca5;
    font-weight: 700;
    margin-bottom: 12px;
}
.metric-value {
    font-size: 22px;
    overflow-wrap: anywhere;
    font-weight: 800;
    letter-spacing: -1px;
    color: #1c2d4a;
}
.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(79, 109, 247, 0.12), rgba(74, 208, 213, 0.18));
    color: var(--blue);
    font-size: 20px;
}
.metric-note {
    margin-top: 10px;
    color: #90a0b8;
    font-size: 12px;
    line-height: 1.45;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}
.side-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.panel {
    border-radius: 22px;
    overflow: hidden;
}
.panel-large { min-width: 0; }
.panel-header {
    padding: 22px 22px 14px;
}
.panel-header-wrap {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.panel-eyebrow {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: #8394ad;
    margin-bottom: 8px;
}
.panel-header h2 {
    margin: 0 0 8px;
    font-size: 20px;
}
.panel-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}
.panel-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.panel-controls input,
.panel-controls select,
.field input,
.field textarea,
.field select {
    border: 1px solid var(--border);
    background: #fbfcff;
    border-radius: 14px;
    padding: 12px 14px;
    color: #243755;
    outline: none;
}
.panel-controls input {
    min-width: 0;
    width: 300px;
    max-width: 100%;
}
.panel-controls input:focus,
.panel-controls select:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: #8ca3ff;
    box-shadow: 0 0 0 4px rgba(79, 109, 247, 0.12);
}

.table-wrap {
    overflow: auto;
    padding: 0 8px 8px;
}
.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.table-wrap th:first-child { width: 25%; }
.table-wrap th:last-child { width: 10%; }
.table-wrap th, .table-wrap td { padding: 12px 8px; overflow-wrap: anywhere; }
.table-wrap th { font-size: 10px; letter-spacing: 0.4px; }
.table-wrap td { font-size: 12px; }
.table-wrap .count-pill, .table-wrap .status-pill { padding: 6px 8px; font-size: 11px; }
.table-wrap .action-group { flex-direction: column; align-items: stretch; }
.table-wrap .action-btn { padding: 7px 8px; font-size: 11px; }
th {
    text-align: left;
    padding: 14px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: #93a3bb;
    border-bottom: 1px solid #e8eef7;
}
td {
    padding: 16px 14px;
    vertical-align: top;
    border-bottom: 1px solid #edf2f8;
    color: #48617a;
    font-size: 13px;
}
.project-title {
    font-weight: 800;
    color: #1d2f4b;
    margin-bottom: 6px;
}
.project-desc {
    color: #6f829c;
    line-height: 1.5;
    margin-bottom: 6px;
}
.mini-note {
    color: #91a0b5;
    font-size: 11px;
    line-height: 1.45;
}
.number-cell {
    font-weight: 800;
    color: #1f3557;
}
.money-cell {
    font-weight: 800;
    color: var(--green);
}
.count-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}
.count-pill {
    background: rgba(79, 109, 247, 0.08);
    color: var(--blue-dark);
}
.status-pill.completed {
    background: rgba(24, 168, 127, 0.12);
    color: #138b68;
}
.status-pill.progress {
    background: rgba(217, 137, 46, 0.12);
    color: #c17818;
}
.status-pill.planned {
    background: rgba(79, 109, 247, 0.10);
    color: #4f6df7;
}
.action-group {
    display: flex;
    gap: 8px;
}
.action-btn {
    border: 1px solid var(--border);
    background: white;
    color: #44546f;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 700;
}
.action-btn.danger:hover {
    background: #fff1f3;
    color: #d34c61;
    border-color: #ffd5dc;
}
.table-footer {
    padding: 14px 22px 18px;
    color: #93a3ba;
    font-size: 12px;
}
.empty-state {
    text-align: center;
    padding: 28px 16px;
}
.empty-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    font-size: 26px;
    color: var(--blue);
    background: rgba(79, 109, 247, 0.10);
}
.empty-state strong {
    display: block;
    font-size: 18px;
    color: #223454;
    margin-bottom: 8px;
}
.empty-state p {
    margin: 0 0 18px;
    color: var(--muted);
}

.panel-body {
    padding: 0 22px 22px;
}
.bar-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr) 68px;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}
.bar-label {
    font-size: 12px;
    color: #5d708c;
    line-height: 1.45;
}
.bar-track {
    background: #edf2fb;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    border-radius: inherit;
}
.bar-value {
    text-align: right;
    font-size: 12px;
    font-weight: 800;
    color: #25405f;
}

.team-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.team-meta { min-width: 0; }
.team-name { font-size: 13px; overflow-wrap: anywhere; }
.team-subtitle { font-size: 11px; }
.team-row .avatar { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; }
.team-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8faff;
    border: 1px solid #ebf0f7;
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(79, 109, 247, 0.14), rgba(74, 208, 213, 0.18));
    color: var(--blue-dark);
    font-weight: 800;
}
.team-name {
    font-weight: 800;
    color: #243654;
    margin-bottom: 4px;
}
.team-subtitle {
    font-size: 12px;
    color: #8c9cb2;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 33, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 30;
}
.hidden { display: none !important; }

.modal-card {
    width: min(880px, 100%);
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    border-radius: 26px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--card-strong);
}
.modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 28px 18px;
    border-bottom: 1px solid #ebeff6;
}
.modal-header h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.9px;
}
.icon-btn {
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f2f5fb;
    color: #6b7c96;
}
#projectForm {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 24px 28px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.field span {
    font-size: 13px;
    font-weight: 700;
    color: #405270;
}
.field-full { grid-column: 1 / -1; }
.field textarea {
    resize: vertical;
    min-height: 96px;
}
.form-section-title {
    margin: 24px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ebeff6;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    font-weight: 800;
    color: #7b8ca5;
}
.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.preview-card {
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(79, 109, 247, 0.08), rgba(74, 208, 213, 0.06));
    border: 1px solid #e5ebf6;
}
.preview-card small {
    display: block;
    color: #7e8fa8;
    font-size: 12px;
    margin-bottom: 8px;
}
.preview-card strong {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #203452;
}
.form-error {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff1f4;
    border: 1px solid #ffd3db;
    color: #b03a50;
    font-weight: 600;
}
.modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 28px;
    border-top: 1px solid #ebeff6;
    background: rgba(255, 255, 255, 0.97);
}
.sticky-footer {
    position: sticky;
    bottom: 0;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    background: #162846;
    color: white;
    padding: 14px 18px;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(18, 37, 72, 0.25);
}

@media (max-width: 1320px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .team-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .app-shell { display: block; }
    .sidebar {
        position: static;
        width: 100%;
        min-width: 100%;
        height: auto;
    }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-card,
    .panel-header-wrap,
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
    }
    .topbar { padding: 18px 20px; gap: 12px; }
    .topbar-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 720px) {
    .main-content { padding: 16px; }
    .hero-card { padding: 20px; }
    .hero-card h1 { font-size: 28px; }
    .hero-side { align-items: stretch; width: 100%; }
    .metric-grid,
    .form-grid,
    .preview-grid {
        grid-template-columns: 1fr;
    }
    .panel-controls input { min-width: 100%; }
    .panel-controls { width: 100%; }
    .panel-controls select { width: 100%; }
    .team-list { grid-template-columns: 1fr; }
    .table-wrap thead { display: none; }
    .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
    .table-wrap tr { margin: 8px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; width: auto; }
    .table-wrap td[data-label] { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
    .table-wrap td[data-label]::before { content: attr(data-label); font-weight: 700; color: var(--muted); }
    .table-wrap td:last-child { border-bottom: 0; }
    .table-wrap .action-group { flex-direction: row; }
    .modal-header,
    .modal-scroll,
    .modal-footer { padding-left: 18px; padding-right: 18px; }
}
