/* Reset & Base — matched to design/prototype/ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f3f4f6;
    color: #111827;
    min-height: 100vh;
}

/* ═══ HEADER ═══ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #d1d5db;
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-right: 1.25rem;
    border-right: 1px solid #e5e7eb;
    margin-right: 1rem;
    flex-shrink: 0;
    text-decoration: none;
    color: #111827;
}

.header-logo-icon {
    width: 24px;
    height: 24px;
    background: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo-icon svg { width: 13px; height: 13px; }

.header-logo-text {
    font-size: .875rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    align-items: stretch;
    height: 48px;
}

.header-nav a {
    display: flex;
    align-items: center;
    padding: 0 .75rem;
    font-size: .875rem;
    color: #6b7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    white-space: nowrap;
}

.header-nav a:hover { color: #111827; background: rgba(0,0,0,.02); }
.header-nav a.active { color: #059669; border-bottom-color: #059669; font-weight: 600; }

/* ═══ NAV DROPDOWN GROUPS ═══ */
.nav-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.nav-group-trigger {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: 0 .75rem;
    font-size: .875rem;
    font-family: inherit;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    height: 48px;
}

.nav-group-trigger:hover { color: #111827; background: rgba(0,0,0,.02); }

.nav-group.active .nav-group-trigger {
    color: #059669;
    border-bottom-color: #059669;
    font-weight: 600;
}

.nav-group-trigger svg {
    transition: transform .15s;
}

.nav-group .dropdown.open + .nav-group-trigger svg,
.nav-group-trigger[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.dropdown.nav-dropdown {
    top: calc(100% - 0px);
    left: 0;
    right: auto;
    min-width: 220px;
}

.dropdown.nav-dropdown .dropdown-item {
    padding: .75rem 1rem;
    font-size: .875rem;
}

.dropdown.nav-dropdown .dropdown-sep {
    margin: .375rem 0;
}

.header-spacer { flex: 1; }

.header-catalog {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-left: 1rem;
    border-left: 1px solid #e5e7eb;
    position: relative;
}

.catalog-select {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .75rem;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: .875rem;
    color: #111827;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s;
    min-width: 160px;
}

.catalog-select:hover { border-color: #9ca3af; }
.catalog-select svg { margin-left: auto; flex-shrink: 0; color: #9ca3af; }

.catalog-menu-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    color: #6b7280;
    font-size: .75rem;
    transition: all .15s;
}

.catalog-menu-btn:hover { background: #f9fafb; color: #111827; }

/* ═══ DROPDOWNS ═══ */
.dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    min-width: 240px;
    z-index: 200;
    display: none;
}

.dropdown.open { display: block; }

.dropdown-hd {
    padding: .5rem .75rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-hd span {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
}

.dropdown-item {
    padding: .5rem .75rem;
    font-size: .875rem;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background .1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    text-decoration: none;
}

.dropdown-item:hover { background: #f9fafb; }
.dropdown-item.selected { color: #059669; font-weight: 600; }
.dropdown-item.selected::after { content: ''; width: 6px; height: 6px; background: #059669; border-radius: 50%; }

.dropdown-item-label { flex: 1; min-width: 0; }

.wip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    margin-left: .5rem;
    flex-shrink: 0;
    transition: opacity .15s;
}

.wip-badge svg { width: 10px; height: 10px; }

.dropdown-item:hover .wip-badge { background: #fde68a; border-color: #f59e0b; }

.dropdown-sep { border-top: 1px solid #e5e7eb; margin: .25rem 0; }

.dropdown-action {
    padding: .5rem .75rem;
    font-size: .875rem;
    color: #059669;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 500;
    transition: background .1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.dropdown-action:hover { background: #f0fdf4; }
.dropdown-action.danger { color: #dc2626; }
.dropdown-action.danger:hover { background: #fef2f2; }

/* ═══ MODALS ═══ */
.modal-ovr {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-ovr.open { display: flex; }

.modal {
    background: #fff;
    border: 1px solid #d1d5db;
    width: 100%;
    max-width: 420px;
}

.modal-hd {
    background: #f9fafb;
    border-bottom: 1px solid #d1d5db;
    padding: .625rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-hd-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6b7280;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { color: #374151; }

.modal-body { padding: 1.25rem; }

.modal-body label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
    margin-bottom: .375rem;
}

.modal-body p {
    font-size: .875rem;
    color: #374151;
    line-height: 1.5;
}

.modal-footer {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    gap: .5rem;
}

/* ═══ FORMS ═══ */
.inp {
    width: 100%;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    padding: .5625rem .75rem;
    font-size: .875rem;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}

.inp:focus { border-color: #059669; }
.inp::placeholder { color: #9ca3af; }

.field { margin-bottom: 1.125rem; }
.field:last-of-type { margin-bottom: 1.5rem; }

/* ═══ BUTTONS ═══ */
.btn-primary {
    background: #059669;
    color: #fff;
    border: 1px solid #059669;
    padding: .5625rem 1.25rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    position: relative;
}

.btn-primary:hover { background: #047857; border-color: #047857; }
.btn-primary:active { background: #065f46; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-ghost {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: .5rem 1.25rem;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}

.btn-ghost:hover { background: #f9fafb; }

.btn-danger {
    background: #dc2626;
    color: #fff;
    border: 1px solid #dc2626;
    padding: .5625rem 1.25rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    position: relative;
}

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; }

/* ═══ SPINNER (for button loading state) ═══ */
.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

.btn-loading .spinner { display: inline-block; }
.btn-loading .btn-text { visibility: hidden; }

.btn-loading {
    pointer-events: none;
    opacity: .8;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══ PAGE BODY ═══ */
.page-body {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* ═══ EMPTY STATE ═══ */
.empty-state { text-align: center; padding: 4rem 2rem; }

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.empty-state-icon svg { width: 28px; height: 28px; color: #9ca3af; }
.empty-state h2 { font-size: 1.125rem; font-weight: 700; color: #111827; margin-bottom: .375rem; }
.empty-state p { font-size: .875rem; color: #6b7280; margin-bottom: 1.5rem; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* ═══ WELCOME TILES ═══ */
.welcome-hd { margin-bottom: 1.5rem; }
.welcome-hd h1 { font-size: 1.25rem; font-weight: 700; color: #111827; letter-spacing: -.01em; }
.welcome-hd p { font-size: .875rem; color: #6b7280; margin-top: .25rem; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .875rem; }

.tile {
    background: #fff;
    border: 1px solid #d1d5db;
    padding: 1.5rem 1.25rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.tile:hover { border-color: #059669; background: #fafffe; }

.tile-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }

.tile-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tile-icon svg { width: 22px; height: 22px; }
.tile-icon.green { background: #f0fdf4; border: 1px solid #a7f3d0; color: #059669; }
.tile-icon.blue { background: #eff6ff; border: 1px solid #bfdbfe; color: #2563eb; }
.tile-icon.violet { background: #f5f3ff; border: 1px solid #ddd6fe; color: #7c3aed; }
.tile-icon.amber { background: #fffbeb; border: 1px solid #fcd34d; color: #d97706; }
.tile-icon.teal { background: #f0fdfa; border: 1px solid #99f6e4; color: #0d9488; }

.tile-count {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
}

.tile-count strong {
    font-size: 1.125rem;
    color: #111827;
    display: block;
    letter-spacing: -.01em;
    margin-bottom: .125rem;
}

.tile h3 { font-size: .9375rem; font-weight: 700; color: #111827; margin-bottom: .25rem; }
.tile p { font-size: .8125rem; color: #6b7280; line-height: 1.4; }

.tile-arrow {
    margin-top: auto;
    padding-top: .875rem;
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: .75rem;
    font-weight: 600;
    color: #059669;
}

.tile-arrow svg { width: 14px; height: 14px; }

/* ═══ WORKSPACE ═══ */
.workspace { padding: 1.5rem; }
