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

:root {
    --bg-top: #f6efe3;
    --bg-bottom: #dde8f6;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-strong: #ffffff;
    --panel-soft: rgba(248, 251, 255, 0.82);
    --ink: #10243f;
    --muted: #50637d;
    --line: #d6e0ec;
    --brand: #0c7a66;
    --brand-hover: #085d4e;
    --accent: #d97706;
    --nav-deep: #0e3768;
    --nav-mid: #185595;
    --nav-bright: #2d78c4;
    --nav-soft-line: rgba(255, 255, 255, 0.16);
    --ok-bg: #dcfce7;
    --ok-text: #14532d;
    --err-bg: #fee2e2;
    --err-text: #7f1d1d;
    --shadow: 0 16px 32px rgba(16, 36, 63, 0.09);
    --shadow-hero: 0 22px 40px rgba(14, 55, 104, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 12%, rgba(12, 122, 102, 0.13), transparent 35%),
        radial-gradient(circle at 92% 0%, rgba(217, 119, 6, 0.14), transparent 28%),
        linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

html {
    scroll-behavior: smooth;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 18px 14px 22px;
}

.app-shell {
    display: grid;
    gap: 0;
}

.app-shell > * + * {
    margin-top: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(214, 224, 236, 0.9);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.site-header {
    padding: 18px 20px 16px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: rgba(18, 64, 118, 0.52);
    background:
        radial-gradient(circle at top right, rgba(255, 202, 87, 0.28), transparent 28%),
        linear-gradient(135deg, var(--nav-deep) 0%, var(--nav-mid) 58%, var(--nav-bright) 100%);
    box-shadow: var(--shadow-hero);
}

.site-header + .main-menu {
    margin-top: 0;
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.brand-strip {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 78px;
    height: 78px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 6px;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.14);
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.site-header .eyebrow {
    color: #ffd27a;
}

h1 {
    margin: 8px 0 0;
    font-size: clamp(1.55rem, 2.8vw, 2.3rem);
    line-height: 1.12;
}

.site-header h1 {
    color: #ffffff;
}

.main-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 16px;
    border-color: rgba(18, 64, 118, 0.52);
    background: linear-gradient(135deg, rgba(14, 55, 104, 0.98), rgba(24, 85, 149, 0.98));
    box-shadow: var(--shadow-hero);
}

.main-menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid var(--nav-soft-line);
    background: rgba(255, 255, 255, 0.08);
    color: #e5eeff;
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.main-menu-link:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    transform: translateY(-1px);
}

.main-menu-link.is-active {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(255, 255, 255, 0.9);
    color: var(--nav-deep);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
}

.main-menu-user {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #e5eeff;
    font-size: 0.84rem;
    font-weight: 700;
}

.main-menu-link-logout {
    background: rgba(127, 29, 29, 0.18);
    border-color: rgba(248, 113, 113, 0.36);
    color: #ffe2e2;
}

.main-menu-link-logout:hover {
    background: rgba(127, 29, 29, 0.3);
    color: #ffffff;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding-top: 28px;
    padding-bottom: 28px;
}

.auth-card {
    width: min(560px, 100%);
    padding: 22px;
    display: grid;
    gap: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.92));
}

.auth-brand {
    align-items: flex-start;
}

.auth-copy .subtitle {
    margin-top: 6px;
}

.auth-form {
    display: grid;
    gap: 10px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field span {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 800;
}

.auth-field input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
}

.auth-field input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.auth-submit {
    margin-top: 4px;
    width: 100%;
}

.page-header {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(560px, 1fr);
    align-items: start;
    gap: 16px;
    padding: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 250, 255, 0.88));
}

.header-copy {
    max-width: 760px;
}

.panel-title {
    margin: 8px 0 0;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    line-height: 1.2;
}

.subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 500;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    margin: 14px 0 0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    background: rgba(12, 122, 102, 0.12);
}

.sync-workspace {
    display: grid;
    gap: 10px;
}

.sync-form {
    display: grid;
    gap: 10px;
}

.sync-accounts-block {
    padding: 12px;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(238, 246, 255, 0.9));
}

.sync-accounts-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.sync-accounts-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    color: #1e3a5f;
}

.sync-accounts-tools {
    display: inline-flex;
    gap: 8px;
}

.mini-action {
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.96);
    color: #1f3c63;
    border-radius: 9px;
    padding: 6px 10px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.06);
}

.mini-action:hover {
    background: #ffffff;
}

.sync-accounts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.sync-account-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #dbe7f3;
    font-size: 0.82rem;
    color: #334155;
    font-weight: 600;
}

.sync-account-item input {
    width: 15px;
    height: 15px;
    accent-color: #1d4ed8;
}

.sync-selection-hint {
    margin: 8px 0 0;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
}

.sync-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sync-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid #fca5a5;
    background: #fff1f2;
    color: #7f1d1d;
    font-size: 0.88rem;
    font-weight: 700;
}

.sync-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: #b91c1c;
}

.sync-button {
    border: 0;
    background: linear-gradient(120deg, var(--brand), #0f9b8a);
    color: #fff;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(12, 122, 102, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sync-button:hover {
    background: linear-gradient(120deg, var(--brand-hover), #0c7a66);
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(12, 122, 102, 0.32);
}

.sync-button:disabled,
.sync-button:disabled:hover {
    cursor: not-allowed;
    background: #9ca3af;
    box-shadow: none;
    transform: none;
}

.sync-required-message {
    margin: 0;
    min-height: 18px;
    color: #b91c1c;
    font-size: 0.8rem;
    font-weight: 700;
}

.alert {
    border-radius: 12px;
    padding: 13px 14px;
    margin: 0;
    font-weight: 700;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--ok-bg);
    color: var(--ok-text);
    border-color: #86efac;
}

.alert-error {
    background: var(--err-bg);
    color: var(--err-text);
    border-color: #fca5a5;
}

.alerts-panel {
    padding: 14px;
    border: 2px solid #ef4444;
    background: linear-gradient(180deg, #fff1f2 0%, #fff7f7 100%);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.alerts-header h2 {
    margin: 0;
    font-size: 1.12rem;
    color: #991b1b;
}

.alerts-header p {
    margin: 6px 0 0;
    color: #7f1d1d;
    font-size: 0.86rem;
}

.alerts-count {
    margin: 10px 0;
    font-weight: 800;
    color: #991b1b;
    font-size: 1rem;
}

.alerts-warning-line {
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fca5a5;
    font-weight: 700;
}

.alerts-empty {
    margin: 10px 0 0;
    color: #7f1d1d;
    font-weight: 600;
}

.alerts-table-wrap {
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fff;
}

.alerts-table th {
    background: #fee2e2;
}

.alert-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.alert-level-critical {
    color: #ffffff;
    background: #b91c1c;
}

.alert-level-urgent {
    color: #7c2d12;
    background: #fdba74;
}

.alert-row-critical td {
    background: #ffe4e6;
}

.alert-row-urgent td {
    background: #fff7ed;
}

.alert-age-oldest td:first-child {
    box-shadow: inset 4px 0 0 #7f1d1d;
}

.alert-age-oldest td {
    font-weight: 700;
}

.alert-age-oldest .alert-level-badge {
    box-shadow: 0 0 0 2px rgba(127, 29, 29, 0.18);
}

.alerts-table tr.alert-row-critical:hover td {
    background: #fecdd3;
}

.alerts-table tr.alert-row-urgent:hover td {
    background: #ffedd5;
}

.filters-panel {
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 255, 0.88));
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.filters-form h2 {
    grid-column: 1 / -1;
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.filter-field-date-range {
    grid-column: span 2;
}

.date-range-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.filter-field label {
    font-size: 0.81rem;
    color: var(--muted);
    font-weight: 700;
}

.filter-field input,
.filter-field select,
.account-form-grid input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
    font-size: 0.9rem;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-field input:focus,
.filter-field select:focus,
.account-form-grid input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    grid-column: 1 / -1;
}

.filter-button,
.account-add-button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.filter-button {
    background: #1d4ed8;
    color: #fff;
}

.filter-button:hover {
    background: #1e40af;
    transform: translateY(-1px);
}

.reset-link,
.state-config-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.84rem;
    border-radius: 10px;
}

.reset-link {
    color: var(--muted);
    padding: 0 2px;
}

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

.state-config-link {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    padding: 9px 12px;
}

.state-config-link:hover {
    background: #dbeafe;
}

.table-meta {
    padding: 10px 14px;
}

.table-meta p {
    margin: 0;
    color: #1e3a5f;
    font-size: 0.88rem;
}

.section-jump {
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.88), rgba(255, 255, 255, 0.9));
    position: sticky;
    top: 14px;
    z-index: 8;
}

.sections-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.sections-stack {
    display: grid;
    gap: 14px;
}

.section-jump-label {
    margin: 0;
    color: #1e3a8a;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-jump-links {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.section-jump-links a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 800;
}

.section-jump-links a:hover {
    background: #dbeafe;
}

.state-admin-panel {
    padding: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 249, 255, 0.9));
}

.state-admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dbe7f3;
}

.config-section {
    border: 1px solid #dbe7f3;
    border-radius: 14px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(239, 246, 255, 0.84));
}

.config-section + .config-section {
    margin-top: 14px;
}

.config-subtitle {
    margin: 6px 0 12px;
    color: var(--muted);
    font-size: 0.84rem;
}

.account-form {
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.account-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
}

.account-add-button {
    background: #0f766e;
    color: #fff;
}

.account-add-button:hover {
    background: #115e59;
    transform: translateY(-1px);
}

.account-form-config {
    margin-bottom: 12px;
}

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

.config-account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
}

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

.config-account-main strong {
    color: #0f172a;
}

.config-account-main span {
    color: #475569;
    font-size: 0.84rem;
}

.protected-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid #facc15;
    background: #fef9c3;
    color: #854d0e;
    font-size: 0.72rem;
    font-weight: 800;
}

.config-account-delete-form {
    margin: 0;
}

.account-delete-button {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #991b1b;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.account-delete-button:hover {
    background: #ffe4e6;
}

.account-delete-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.config-help {
    margin: 10px 0 0;
    color: #7f1d1d;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-form-grid {
    grid-template-columns: 1fr 1fr auto;
}

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

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
}

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

.user-main strong {
    color: #0f172a;
}

.user-main span {
    color: #475569;
    font-size: 0.84rem;
}

.user-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.user-status-active {
    color: #14532d;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.user-status-inactive {
    color: #7f1d1d;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

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

.user-actions form {
    margin: 0;
}

.user-action-link {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 8px;
}

.state-admin-form {
    display: grid;
    gap: 12px;
}

.state-admin-header h2 {
    margin: 0;
    font-size: 1.03rem;
}

.state-admin-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.state-visibility-tools {
    margin-top: 10px;
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.state-visibility-tools .mini-action {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1e3a8a;
}

.state-visibility-tools .mini-action:hover {
    background: #bfdbfe;
}

.state-admin-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 110px 120px 120px;
    gap: 8px 10px;
    align-items: center;
}

.state-admin-grid-head {
    font-weight: 800;
    font-size: 0.78rem;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.state-admin-item {
    font-size: 0.86rem;
    color: #0f172a;
    font-weight: 700;
}

.state-color-input {
    width: 76px;
    height: 36px;
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.state-visible-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 700;
}

.state-visible-toggle input {
    width: 16px;
    height: 16px;
    accent-color: #1d4ed8;
}

.state-admin-actions {
    display: flex;
    justify-content: flex-end;
}

.table-card {
    overflow: hidden;
}

.table-card-head {
    padding: 14px 14px 8px;
}

.table-card .alerts-count,
.table-card .alerts-empty {
    padding-left: 14px;
    padding-right: 14px;
}

.table-card {
    scroll-margin-top: 14px;
}

.empty-state {
    padding: 22px;
}

.empty-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.empty-subtitle {
    margin: 8px 0 0;
    color: var(--muted);
}

.table-card .table-wrap {
    overflow: auto;
    max-height: 70vh;
    border-top: 1px solid var(--line);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    text-align: left;
    padding: 7px 7px;
    border-bottom: 1px solid var(--line);
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #eef5ff;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    box-shadow: inset 0 -1px 0 #c7d7ea;
}

tbody tr:nth-child(2n) td {
    background: rgba(251, 253, 255, 0.92);
}

tr:hover td {
    background: #eef7ff;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.72rem;
    color: #0f172a;
    background: #fde68a;
    border: 1px solid #fbbf24;
    cursor: help;
}

.event-empty {
    color: #94a3b8;
}

.sas-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #0c4a6e;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
}

.state-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #1f2937;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
}

.recepisse-copy {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.recepisse-copy:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.recepisse-copy:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.preview-mail-button {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 8px;
    padding: 6px 9px;
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
}

.preview-mail-button:hover {
    background: #dbeafe;
}

.mail-preview-modal[hidden] {
    display: none;
}

.mail-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
}

.mail-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
}

.mail-preview-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, calc(100vw - 28px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    margin: 20px auto;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(214, 224, 236, 0.9);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(245, 249, 255, 0.95));
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
}

.mail-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.mail-preview-close {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.mail-preview-meta,
.mail-preview-subject {
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #dbe7f3;
    background: rgba(255, 255, 255, 0.84);
}

.mail-preview-meta {
    color: #334155;
    font-size: 0.88rem;
    line-height: 1.6;
}

.mail-preview-subject {
    margin-top: 10px;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
}

.mail-preview-history {
    margin: 10px 0 0;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
}

.mail-preview-field {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.mail-preview-field span {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 800;
}

.mail-preview-field input,
.mail-preview-field textarea {
    width: 100%;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #10243f;
    font: inherit;
}

.mail-preview-field textarea {
    resize: vertical;
    min-height: 220px;
}

.mail-preview-field input:focus,
.mail-preview-field textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.mail-preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.secondary-button {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
}

.mail-preview-body {
    margin: 10px 0 0;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #dbe7f3;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: "Manrope", "Segoe UI", sans-serif;
}

.copy-feedback {
    position: fixed;
    right: 14px;
    bottom: 14px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #93c5fd;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(30, 58, 138, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 50;
}

.copy-feedback.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1200px) {
    th,
    td {
        font-size: 0.74rem;
        padding: 6px 6px;
    }

    th {
        font-size: 0.71rem;
    }
}

@media (max-width: 980px) {
    .page-header {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .brand-logo {
        width: 60px;
        height: 60px;
    }

    .main-menu {
        flex-direction: column;
        align-items: stretch;
    }

    .main-menu-link {
        width: 100%;
    }

    .main-menu-user {
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }

    .sync-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .sync-checkbox,
    .sync-button {
        width: 100%;
        justify-content: flex-start;
    }

    .sync-accounts-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .account-form-grid,
    .date-range-grid,
    .state-admin-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

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

    .section-jump {
        position: static;
    }

    .section-jump-links a {
        width: 100%;
        justify-content: center;
    }

    .filter-field-date-range {
        grid-column: span 1;
    }

    .state-admin-grid-head {
        display: none;
    }

    .state-admin-topbar,
    .config-account-row,
    .user-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .config-account-delete-form,
    .account-delete-button,
    .state-admin-actions .filter-button,
    .state-config-link {
        width: 100%;
    }

    .user-actions {
        width: 100%;
    }

    .user-actions form,
    .user-action-link {
        width: 100%;
    }

    .state-admin-actions {
        justify-content: stretch;
    }

    .mail-preview-header {
        flex-direction: column;
    }
}
