:root {
    --bg-main: #0f0f10;
    --bg-sidebar: #171717;
    --bg-surface: #1f1f23;
    --bg-surface-hover: #2a2a2f;
    --bg-elevated: #242428;
    --bg-overlay: rgba(8, 8, 10, 0.7);

    --border-soft: #303036;
    --border-strong: #3f3f46;
    --border-accent: rgba(16, 163, 127, 0.35);

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent: #10a37f;
    --accent-hover: #0e8f70;
    --accent-soft: rgba(16, 163, 127, 0.14);

    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.14);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.14);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.14);
    --info: #3b82f6;
    --info-soft: rgba(59, 130, 246, 0.14);

    --shadow-soft: 0 22px 60px rgba(0, 0, 0, 0.26);
    --shadow-focus: 0 0 0 4px rgba(16, 163, 127, 0.16);

    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 18px;
    --radius-2xl: 20px;
    --radius-pill: 999px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;

    --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at top left, rgba(16, 163, 127, 0.1), transparent 24%),
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.04), transparent 18%),
        var(--bg-main);
    color: var(--text-primary);
    font: 400 14px/1.5 var(--font-sans);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
}

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

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

p,
h1,
h2,
h3,
h4,
dl,
dd {
    margin: 0;
}

ul,
ol {
    margin: 0;
    padding: 0;
}

table {
    border-collapse: collapse;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon {
    flex: 0 0 auto;
}

.content__inner {
    width: 100%;
}

.section-stack {
    display: grid;
    gap: var(--space-6);
}

.page-section {
    display: grid;
    gap: var(--space-4);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.section-heading h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-heading p {
    color: var(--text-secondary);
}

.card,
.placeholder-card,
.surface-card {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)), var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.card,
.surface-card {
    padding: 22px;
}

.placeholder-card {
    padding: 24px;
}

.card--muted {
    background: var(--bg-elevated);
}

.card--accent {
    border-color: var(--border-accent);
}

.metric-card {
    display: grid;
    gap: var(--space-4);
    min-height: 144px;
}

.metric-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.metric-card__label {
    color: var(--text-secondary);
    font-size: 13px;
}

.metric-card__value {
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 700;
    line-height: 1;
}

.metric-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    color: var(--text-muted);
}

.metric-card__delta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 600;
}

.metric-card__delta.is-danger {
    color: var(--danger);
}

.metric-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.metric-card__icon.is-accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.metric-card__icon.is-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.metric-card__icon.is-info {
    background: var(--info-soft);
    color: var(--info);
}

.metric-card__icon.is-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.button,
.button:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

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

.button:focus-visible,
.icon-button:focus-visible,
.user-chip:focus-visible,
.sidebar__meta-button:focus-visible,
.input:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.button[disabled],
.button[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.button--primary {
    background: linear-gradient(180deg, #17c499, var(--accent));
    color: #ffffff;
}

.button--primary:hover,
.button--primary:focus-visible {
    background: linear-gradient(180deg, #15b98f, var(--accent-hover));
}

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

.button--secondary:hover,
.button--secondary:focus-visible {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

.button--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.button--ghost:hover,
.button--ghost:focus-visible {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.button--danger {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}

.button--full {
    width: 100%;
}

.button--small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.button__icon {
    color: currentColor;
}

.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        color 0.18s ease,
        border-color 0.18s ease,
        background-color 0.18s ease,
        transform 0.18s ease;
}

.icon-button:hover,
.icon-button:focus-visible {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-surface-hover);
    transform: translateY(-1px);
}

.icon-button--ghost {
    background: transparent;
}

.icon-button__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
}

.user-chip__avatar,
.avatar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(16, 163, 127, 0.32), rgba(16, 163, 127, 0.14));
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.user-chip__text {
    display: grid;
    gap: 1px;
    text-align: left;
}

.user-chip__text strong {
    font-size: 13px;
    font-weight: 600;
}

.user-chip__text small {
    color: var(--text-muted);
    font-size: 12px;
}

.dropdown {
    position: relative;
}

.dropdown__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    width: min(320px, calc(100vw - 32px));
    display: none;
    padding: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: rgba(28, 28, 31, 0.96);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.dropdown.is-open .dropdown__menu {
    display: block;
}

.dropdown__menu--notifications {
    width: min(360px, calc(100vw - 32px));
}

.dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 6px 6px 10px;
    color: var(--text-secondary);
}

.dropdown__header strong {
    color: var(--text-primary);
}

.dropdown__header a {
    color: var(--accent);
    font-size: 13px;
}

.dropdown__item,
.dropdown__link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    color: var(--text-secondary);
}

.dropdown__item:hover,
.dropdown__link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.dropdown__item.is-unread {
    background: rgba(16, 163, 127, 0.08);
}

.dropdown__item strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text-primary);
    font-size: 13px;
}

.dropdown__item p {
    color: var(--text-secondary);
    font-size: 12px;
}

.dropdown__empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: var(--text-muted);
}

.toast-stack {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 24px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: rgba(28, 28, 31, 0.95);
    box-shadow: var(--shadow-soft);
    pointer-events: auto;
}

.toast--success {
    border-color: rgba(34, 197, 94, 0.22);
}

.toast--error {
    border-color: rgba(239, 68, 68, 0.22);
}

.toast--warning {
    border-color: rgba(245, 158, 11, 0.22);
}

.toast__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.toast__body {
    flex: 1;
    min-width: 0;
}

.toast__body strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.toast__body p {
    color: var(--text-secondary);
    font-size: 13px;
}

.toast__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.form-grid {
    display: grid;
    gap: var(--space-5);
}

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

.form-card {
    display: grid;
    gap: var(--space-6);
}

.form-field,
.auth-form label {
    display: grid;
    gap: 8px;
}

.field-label,
.auth-form span {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.field-hint,
.field-note,
.project-muted,
.muted-copy {
    color: var(--text-muted);
    font-size: 13px;
}

.field-error {
    color: #fca5a5;
    font-size: 12px;
}

input,
select,
textarea,
.input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    transition:
        border-color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

textarea {
    min-height: 120px;
    padding: 12px 14px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: var(--shadow-focus);
    outline: none;
}

.is-invalid input,
.is-invalid select,
.is-invalid textarea,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 48px;
}

.password-field__toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
}

.alert--success {
    border-color: rgba(34, 197, 94, 0.22);
    background: var(--success-soft);
    color: #9ae6b4;
}

.alert--error {
    border-color: rgba(239, 68, 68, 0.22);
    background: var(--danger-soft);
    color: #fca5a5;
}

.alert--warning {
    border-color: rgba(245, 158, 11, 0.22);
    background: var(--warning-soft);
    color: #fcd34d;
}

.alert--info {
    border-color: rgba(59, 130, 246, 0.22);
    background: var(--info-soft);
    color: #93c5fd;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge--success {
    background: var(--success-soft);
    color: #86efac;
}

.status-badge--danger {
    background: var(--danger-soft);
    color: #fca5a5;
}

.status-badge--warning {
    background: var(--warning-soft);
    color: #fcd34d;
}

.status-badge--info {
    background: var(--info-soft);
    color: #93c5fd;
}

.status-badge--neutral {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.chip-group,
.segmented-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip,
.tab-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 13px;
}

.chip.is-active,
.tab-chip.is-active {
    border-color: var(--border-accent);
    background: rgba(16, 163, 127, 0.12);
    color: var(--text-primary);
}

.progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.06);
}

.progress__bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #19c79b, var(--accent));
}

.stats-list {
    display: grid;
    gap: 12px;
}

.stats-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.stats-list dt {
    color: var(--text-secondary);
}

.stats-list dd {
    margin: 0;
    font-weight: 600;
}

.list {
    display: grid;
    gap: 12px;
    list-style: none;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.media-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.media-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(16, 163, 127, 0.24), rgba(16, 163, 127, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.table-card,
.data-table-card {
    display: grid;
    gap: var(--space-4);
}

.table-wrap {
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
}

.data-table,
.projects-table {
    width: 100%;
    min-width: 760px;
}

.data-table thead th,
.projects-table thead th {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.data-table tbody td,
.projects-table tbody td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

.data-table tbody tr:last-child td,
.projects-table tbody tr:last-child td {
    border-bottom: 0;
}

.row-title {
    display: grid;
    gap: 3px;
}

.row-title strong {
    font-size: 14px;
    font-weight: 600;
}

.row-title span {
    color: var(--text-muted);
    font-size: 12px;
}

.row-actions,
.project-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.project-actions form {
    margin: 0;
}

.empty-state {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 34px 20px;
    text-align: center;
}

.empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(16, 163, 127, 0.12);
    color: var(--accent);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
}

.empty-state p {
    max-width: 460px;
    color: var(--text-secondary);
}

.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 48px;
    height: 28px;
    padding: 3px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
}

.toggle::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.18s ease;
}

.toggle.is-active {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle.is-active::after {
    transform: translateX(19px);
}

.inline-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.note-block {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
}

.two-column-layout {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
}

.project-checklist {
    display: grid;
    gap: 12px;
    list-style: none;
}

.project-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-secondary);
}

.project-checklist li .icon {
    margin-top: 1px;
    color: var(--accent);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-overlay);
}

.modal-backdrop.is-open {
    display: flex;
}

.modal {
    width: min(100%, 540px);
    padding: 24px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-2xl);
    background: var(--bg-surface);
    box-shadow: var(--shadow-soft);
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

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

    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .toast-stack {
        top: 16px;
        right: 16px;
        left: 16px;
        width: auto;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 13px;
    }

    .card,
    .surface-card,
    .placeholder-card {
        padding: 18px;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .button,
    .icon-button,
    .user-chip {
        min-height: 40px;
    }

    .data-table,
    .projects-table {
        min-width: 0;
    }
}
