:root {
    --background: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #6d7788;
    --line: #e1e7ef;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #15803d;
    --success-soft: #ecfdf3;
    --warning: #a16207;
    --warning-soft: #fffbeb;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --sidebar: 264px;
    --radius: 14px;
    --shadow: 0 12px 30px rgba(28, 39, 59, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.login-page {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.13), transparent 32rem),
        radial-gradient(circle at 85% 90%, rgba(14, 165, 233, 0.09), transparent 30rem),
        var(--background);
}

.login-card {
    width: min(100%, 460px);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}




.login-card h1 {
    margin: 0 0 25px;
    font-size: clamp(25px, 6vw, 32px);
    line-height: 1.2;
    text-align: center;
}


.field {
    display: grid;
    gap: 7px;
}

.field + .field {
    margin-top: 15px;
}

.field label {
    font-size: 13px;
    font-weight: 700;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfd8e5;
    border-radius: 10px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.login-actions {
    margin-top: 20px;
    display: grid;
    gap: 10px;
}

.button {
    min-height: 42px;
    padding: 9px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 750;
    text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #ffffff;
    background: var(--primary);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    border-color: var(--line);
    color: var(--text);
    background: var(--surface);
}

.button-secondary:hover {
    border-color: #b9c5d5;
    background: var(--surface-soft);
}

.button-danger {
    border-color: #fecaca;
    color: var(--danger);
    background: var(--danger-soft);
}

.button-small {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
}

.button svg,
.icon-button svg,
.nav-button svg,
.demo-action svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.credentials {
    margin-top: 16px;
    padding: 12px;
    display: flex;
    justify-content: center;
    gap: 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #475569;
    background: var(--surface-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    direction: ltr;
}

.login-error {
    margin-top: 13px;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 9px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 13px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px 16px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: var(--surface);
    z-index: 20;
}

.brand {
    padding: 7px 10px 22px;
}

.brand-title {
    margin: 0;
    color: var(--primary);
    font-size: 21px;
    font-weight: 850;
}

.brand-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.nav-list {
    display: grid;
    gap: 7px;
}

.nav-button {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: 10px;
    color: #516073;
    background: transparent;
    font-weight: 700;
    text-align: left;
}

.nav-button:hover {
    background: #f1f5f9;
}

.nav-button.active {
    color: var(--primary);
    background: var(--primary-soft);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--line);
}



.demo-action {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 9px;
    color: #5d6878;
    background: transparent;
    font-size: 13px;
    font-weight: 650;
}

.demo-action:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.main-column {
    min-width: 0;
}

.mobile-header {
    display: none;
}

.page {
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 30px clamp(20px, 4vw, 52px) 60px;
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.2;
}

.page-header p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}



.metrics {
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.metric-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.metric-value {
    margin: 0;
    font-size: 28px;
    font-weight: 850;
    line-height: 1;
}

.metric-detail {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.panel {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.panel-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    margin: 0;
    font-size: 18px;
}

.panel-subtitle {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.filters {
    padding: 14px 20px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.search-wrap {
    position: relative;
}

.search-wrap svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 17px;
    height: 17px;
    color: #94a3b8;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-wrap .input {
    padding-left: 38px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 16px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #64748b;
    background: #fbfcfe;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

td {
    color: #425066;
    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fbfdff;
}

.primary-cell {
    color: var(--text);
    font-weight: 750;
}

.link-button {
    padding: 0;
    border: 0;
    color: var(--primary);
    background: transparent;
    font-weight: 750;
    text-align: left;
}

.link-button:hover {
    text-decoration: underline;
}

.row-actions {
    display: flex;
    gap: 5px;
}

.icon-button {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #667085;
    background: transparent;
}

.icon-button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.status {
    width: fit-content;
    padding: 4px 9px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status-active {
    color: var(--warning);
    background: var(--warning-soft);
}

.status-draft {
    color: #475569;
    background: #f1f5f9;
}

.status-closed,
.status-done {
    color: var(--success);
    background: var(--success-soft);
}

.status-late {
    color: var(--danger);
    background: var(--danger-soft);
}

.status-review {
    color: #6d28d9;
    background: #f5f3ff;
}

.progress {
    width: 100px;
}

.progress-bar {
    width: 100%;
    height: 7px;
    display: block;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #e8edf4;
    appearance: none;
}

.progress-bar::-webkit-progress-bar {
    border-radius: 999px;
    background: #e8edf4;
}

.progress-bar::-webkit-progress-value {
    border-radius: 999px;
    background: var(--primary);
}

.progress-bar::-moz-progress-bar {
    border-radius: 999px;
    background: var(--primary);
}

.progress-label {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.inline-select {
    min-width: 135px;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    color: #425066;
    background: var(--surface);
    outline: none;
}

.empty-state {
    padding: 38px 20px;
    color: var(--muted);
    text-align: center;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.person-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.person-card h3 {
    margin: 0 0 4px;
    font-size: 17px;
}

.person-role {
    margin: 0 0 14px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 750;
}

.person-meta {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    direction: ltr;
    text-align: left;
}

.person-footer {
    margin-top: 15px;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid var(--line);
}

.count-chip {
    padding: 4px 8px;
    border-radius: 999px;
    color: #475569;
    background: #f1f5f9;
    font-size: 11px;
    font-weight: 700;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    padding: 20px;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.55);
    z-index: 100;
}

.modal {
    width: min(100%, 620px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 17px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.modal-wide {
    width: min(100%, 860px);
}

.modal-header {
    position: sticky;
    top: 0;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    z-index: 2;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    border-top: 1px solid var(--line);
    background: #fbfcfe;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.field-full {
    grid-column: 1 / -1;
}

.close-button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    color: #64748b;
    background: #f1f5f9;
}

.close-button:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.close-button svg {
    width: 19px;
    height: 19px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.detail-label {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.detail-value {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.modal-section {
    margin-top: 20px;
}

.modal-section h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.attachment-list {
    display: grid;
    gap: 8px;
}

.attachment-item {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    font-size: 12px;
}

.attachment-label {
    color: var(--muted);
    font-size: 11px;
}

.toast {
    position: fixed;
    left: 22px;
    bottom: 22px;
    max-width: min(390px, calc(100vw - 44px));
    padding: 12px 15px;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    color: #166534;
    background: #f0fdf4;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 650;
    z-index: 200;
}

.toast.error {
    border-color: #fecaca;
    color: var(--danger);
    background: var(--danger-soft);
}

@media (max-width: 1100px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .people-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(var(--sidebar), 84vw);
        border-right: 1px solid var(--line);
        transform: translateX(-105%);
        transition: transform 180ms ease;
        box-shadow: 18px 0 50px rgba(15, 23, 42, 0.15);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-header {
        position: sticky;
        top: 0;
        min-height: 60px;
        padding: 10px 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        z-index: 15;
    }

    .mobile-title {
        font-weight: 800;
    }

    .mobile-menu {
        width: 39px;
        height: 39px;
        padding: 0;
        display: grid;
        place-items: center;
        border: 0;
        border-radius: 9px;
        color: var(--primary);
        background: var(--primary-soft);
    }

    .mobile-menu svg {
        width: 20px;
        height: 20px;
    }

    .page {
        padding-top: 22px;
    }

    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .search-wrap {
        grid-column: 1 / -1;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .login-card {
        padding: 26px 20px;
    }

    .credentials {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .page {
        padding-inline: 14px;
    }

    .page-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .button {
        flex: 1 1 140px;
    }

    .metrics,
    .people-grid,
    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .search-wrap {
        grid-column: auto;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .modal-backdrop {
        padding: 10px;
    }

    .modal {
        max-height: calc(100vh - 20px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
