:root {
    --sate-cyan: #07b2ab;
    --sate-dark: #0d4140;
    --sate-soft: #aae3db;
    --sate-mint: #64f9d1;
    --sate-deep: #00240e;
    --text: #12302f;
    --muted: #5f7472;
    --surface: #ffffff;
    --surface-soft: #eef7f5;
    --line: #d7ece8;
    --danger: #a82020;
    --danger-bg: #fff1f1;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    width: 100%;
    min-height: 100vh;
    color: var(--text);
    background: var(--surface-soft);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: var(--sate-dark);
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    color: var(--sate-cyan);
}

h1 {
    margin: 0;
    color: var(--sate-deep);
    font-size: 30px;
    line-height: 1.2;
}

h2 {
    margin: 0;
    color: var(--sate-deep);
    font-size: 24px;
    line-height: 1.25;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.brand-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
    color: var(--sate-deep);
    background: var(--sate-mint);
    font-weight: 900;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--sate-dark);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    width: min(100%, 980px);
    min-height: 560px;
    overflow: hidden;
    border: 1px solid rgba(170, 227, 219, 0.22);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 36, 14, 0.26);
}

.login-intro {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 42px;
    color: #ffffff;
    background:
        linear-gradient(145deg, rgba(0, 36, 14, 0.94), rgba(13, 65, 64, 0.92)),
        var(--sate-dark);
}

.brand-lockup,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup {
    margin-bottom: auto;
}

.brand-lockup strong,
.sidebar-brand strong {
    display: block;
    letter-spacing: 0;
}

.brand-lockup small,
.sidebar-brand small {
    display: block;
    margin-top: 3px;
    color: var(--sate-soft);
}

.login-intro h1 {
    max-width: 520px;
    margin-bottom: 14px;
    color: #ffffff;
    font-size: 38px;
}

.login-intro p {
    max-width: 520px;
    color: var(--sate-soft);
}

.login-panel {
    width: 100%;
    padding: 42px;
    border-left: 1px solid var(--line);
    background: var(--surface);
}

.form-eyebrow,
.page-kicker {
    display: block;
    margin-bottom: 8px;
    color: var(--sate-cyan);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.form-stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--sate-dark);
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
}

select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: #ffffff;
    font: inherit;
}

textarea {
    resize: vertical;
}

input:focus {
    border-color: var(--sate-cyan);
    outline: 3px solid rgba(7, 178, 171, 0.16);
}

select:focus,
textarea:focus {
    border-color: var(--sate-cyan);
    outline: 3px solid rgba(7, 178, 171, 0.16);
}

button {
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    background: var(--sate-cyan);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

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

.alert {
    margin-top: 20px;
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid #ffd0d0;
}

.alert-success {
    color: var(--sate-deep);
    background: #e9fbf7;
    border: 1px solid var(--sate-soft);
}

.app-page {
    background: var(--surface-soft);
}

.app-shell {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 270px;
    min-width: 270px;
    height: 100vh;
    padding: 22px;
    color: #ffffff;
    background: var(--sate-dark);
}

.sidebar-brand {
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(170, 227, 219, 0.18);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 24px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 6px;
    color: var(--sate-soft);
    font-weight: 800;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: #ffffff;
    background: rgba(7, 178, 171, 0.22);
}

.sidebar-user {
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(170, 227, 219, 0.18);
}

.sidebar-user span {
    font-weight: 900;
}

.sidebar-user small {
    color: var(--sate-soft);
}

.sidebar-user a {
    margin-top: 10px;
    color: var(--sate-mint);
}

.main-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 30px;
}

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

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 6px;
    color: #ffffff;
    background: var(--sate-cyan);
    font-weight: 900;
}

.action-button:hover {
    color: #ffffff;
    background: var(--sate-dark);
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--sate-dark);
    background: #ffffff;
    font-weight: 900;
}

.secondary-button:hover {
    color: #ffffff;
    background: var(--sate-dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.metric-card,
.work-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(13, 65, 64, 0.07);
}

.metric-card {
    min-height: 150px;
    padding: 20px;
}

.metric-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    margin: 18px 0 10px;
    color: var(--sate-deep);
    font-size: 36px;
}

.metric-card small {
    color: var(--muted);
    line-height: 1.4;
}

.work-panel {
    margin-top: 18px;
    padding: 24px;
}

.work-panel h2 {
    margin-bottom: 8px;
}

.filter-panel,
.form-card,
.table-card {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(13, 65, 64, 0.07);
}

.filter-panel {
    margin-bottom: 18px;
    padding: 18px;
}

.filters-form {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 0.8fr auto;
    gap: 14px;
    align-items: end;
}

.compact-filters {
    grid-template-columns: minmax(180px, 260px) auto;
    justify-content: start;
}

.representatives-filters {
    grid-template-columns: 1.4fr 1fr 0.8fr auto;
}

.filters-form > label,
.entity-form > label {
    min-width: 0;
}

.form-card {
    max-width: 980px;
    padding: 22px;
}

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

.form-wide {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    grid-column: 1 / -1;
    padding-top: 8px;
}

.table-card {
    overflow: hidden;
}

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

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

.compact-table {
    min-width: 620px;
}

.representatives-table {
    min-width: 880px;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--sate-dark);
    background: #f7fcfb;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

td {
    color: var(--text);
    font-size: 14px;
}

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

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--sate-dark);
    background: #e9fbf7;
    font-size: 12px;
    font-weight: 900;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.table-actions form {
    margin: 0;
}

.link-button {
    min-height: auto;
    padding: 0;
    color: var(--danger);
    background: transparent;
    font-weight: 900;
}

.link-button:hover {
    color: var(--sate-dark);
    background: transparent;
}

.csv-help {
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #f7fcfb;
}

.csv-help strong {
    display: block;
    margin-bottom: 6px;
    color: var(--sate-dark);
}

.import-result {
    margin-top: 18px;
    padding: 22px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.result-grid div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fcfb;
}

.result-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.result-grid strong {
    display: block;
    margin-top: 8px;
    color: var(--sate-deep);
    font-size: 26px;
}

@media (max-width: 920px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-intro {
        min-height: 280px;
    }

    .login-panel {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-width: 0;
        height: auto;
    }

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

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

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

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

@media (max-width: 620px) {
    .login-page {
        padding: 14px;
    }

    .login-intro,
    .login-panel {
        padding: 28px;
    }

    .login-intro h1 {
        font-size: 30px;
    }

    .main-content {
        padding: 20px;
    }

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

    .sidebar-nav,
    .summary-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .header-actions,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .header-actions a,
    .form-actions a,
    .form-actions button {
        width: 100%;
    }
}
