:root {
    --fm-primary: #18263a;
    --fm-primary-hover: #223651;
    --fm-accent: #2f6fed;
    --fm-accent-light: #eaf1ff;
    --fm-background: #f6f8fb;
    --fm-surface: #ffffff;
    --fm-border: #e3e8ef;
    --fm-text: #162033;
    --fm-text-secondary: #667085;
    --fm-text-muted: #98a2b3;
    --fm-success: #16a36a;
    --fm-warning: #f59e0b;
    --fm-critical: #e5484d;
    --fm-neutral-soft: #f0f3f7;
    --fm-success-soft: #eaf8f1;
    --fm-warning-soft: #fff6e6;
    --fm-critical-soft: #fff0f1;
    --fm-chart-track: #e9eef5;
    --fm-radius: 12px;
}

:root[data-theme="dark"] {
    --fm-primary: #101d2e;
    --fm-primary-hover: #1b304b;
    --fm-accent: #70a0ff;
    --fm-accent-light: #1b3359;
    --fm-background: #101722;
    --fm-surface: #172231;
    --fm-border: #2a3a50;
    --fm-text: #edf3fb;
    --fm-text-secondary: #afbed1;
    --fm-text-muted: #7f91a8;
    --fm-success: #3bc985;
    --fm-warning: #f6b84a;
    --fm-critical: #ff7177;
    --fm-neutral-soft: #233246;
    --fm-success-soft: #143d30;
    --fm-warning-soft: #493718;
    --fm-critical-soft: #48262e;
    --fm-chart-track: #2a3a50;
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--fm-background);
    color: var(--fm-text);
}

/* FocusOnNavigate programmatically focuses page headings; headings are not controls. */
h1:focus {
    outline: none;
}

.standard-input {
    height: 2.75rem;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--fm-border);
    background: var(--fm-surface);
    color: var(--fm-text);
    box-shadow: none;
}

.primary-button {
    border: none;
    background-color: var(--fm-primary);
    border-radius: 8px;
    min-height: 2.5rem;
    width: 100%;
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
}

.secondary-button {
    border: none;
    border-color: var(--fm-primary);
    border-style: solid;
    border-width: 1px;
    background-color: var(--fm-surface);
    border-radius: 8px;
    min-height: 2.5rem;
    width: 100%;
    color: var(--fm-primary);
    font-size: .875rem;
    font-weight: 600;
}

.hover:hover{
    opacity: 0.8;
    cursor: pointer;
}

.primary-button:disabled{
    opacity: .8;
    cursor: not-allowed;
}

p{
    font-size: 1.5vh !important;
}

input {
    font-size: 1.8vh !important;
}

label {
    font-size: 2vh !important;
}

h2{
    font-size: 2.25vh !important;
}

h3{
    font-size: 2.5vh !important;
}

/* A single header system for every primary dashboard panel. */
.dashboard-panel {
    overflow: hidden;
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    background: var(--fm-surface);
}

.dashboard-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.875rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fm-border);
}

.dashboard-panel__kicker {
    margin: 0 0 .25rem;
    color: var(--fm-text-muted);
    font-size: .6875rem !important;
    font-weight: 600;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.dashboard-panel__title {
    margin: 0;
    color: var(--fm-text);
    font-size: 1.125rem !important;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.25;
}

.dashboard-panel__meta {
    flex-shrink: 0;
    color: var(--fm-text-muted);
    font-size: .75rem;
    white-space: nowrap;
}

/* Shared, responsive layout for the legacy entity lists. */
#main-content .entity-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: min(100% - 3rem, 100rem);
    min-height: 4.875rem;
    margin: 2rem auto 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--fm-border);
    border-bottom: 0;
    border-radius: var(--fm-radius) var(--fm-radius) 0 0;
    background: var(--fm-surface);
}

#main-content .entity-list-heading h3 {
    margin: 0;
    color: var(--fm-text);
    font-size: 1.125rem !important;
    font-weight: 600;
}

#main-content .entity-list-heading .add-btn {
    width: auto;
    min-width: 5.25rem;
    letter-spacing: normal;
}

#main-content .entity-list-card#main-container {
    width: min(100% - 3rem, 100rem);
    min-height: 0;
    margin: 0 auto 2rem;
    overflow: visible;
    border: 1px solid var(--fm-border);
    border-radius: 0 0 var(--fm-radius) var(--fm-radius);
    background: var(--fm-surface);
    box-shadow: none;
}

#main-content .entity-list-card > div > header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: auto;
    min-height: 4.5rem;
    margin: 0;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--fm-border);
}

#main-content .entity-list-card #header-second-container {
    width: auto;
    gap: .5rem;
}

#main-content .entity-list-card header select,
#main-content .entity-list-card .filters {
    width: auto;
    min-width: 0;
    height: 2.5rem;
    padding: .5rem .75rem;
    border: 1px solid var(--fm-border);
    border-radius: 8px;
    background: var(--fm-surface);
    color: var(--fm-text);
    font-size: .8125rem !important;
    font-weight: 600;
    letter-spacing: normal;
}

#main-content .entity-list-card .filters {
    display: inline-flex;
    justify-content: center;
    gap: .375rem;
    cursor: pointer;
}

#main-content .entity-list-card .filters .material-symbols-outlined { font-size: 1rem; }
#main-content .entity-list-card #filters-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    height: auto;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fm-border);
}

#main-content .entity-list-card #filters-box .input-wrapper { width: auto; }
#main-content .entity-list-card .input-wrapper label { color: var(--fm-text-muted); font-size: .6875rem !important; }
#main-content .entity-list-card .standard-input,
#main-content .entity-list-card #filters-box select {
    width: 100%;
    height: 2.5rem;
    padding: .5rem .75rem;
    border: 1px solid var(--fm-border);
    border-radius: 8px;
    background: var(--fm-surface);
    box-shadow: none;
    color: var(--fm-text);
    font-size: .8125rem !important;
}

#main-content .entity-list-card table { width: calc(100% - 2.5rem); margin: 1.25rem; overflow: hidden; border: 1px solid var(--fm-border); border-radius: .75rem; table-layout: auto; }
#main-content .entity-list-card table thead { height: auto; background: var(--fm-background); }
#main-content .entity-list-card table thead tr th { padding: .75rem .625rem; color: var(--fm-text-muted); font-family: inherit; font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
#main-content .entity-list-card table thead tr th:first-child { width: 2.5rem; padding-left: .625rem; }
#main-content .entity-list-card table thead tr th:last-child { width: 3rem; padding-right: .625rem; }
#main-content .entity-list-card table thead tr th span { font-size: 1rem; }
#main-content .entity-list-card table tbody tr { height: auto; }
#main-content .entity-list-card table tbody tr td { padding: .75rem .625rem; border-bottom: 1px solid var(--fm-border); color: var(--fm-text); font-size: .875rem; }
#main-content .entity-list-card table tbody tr:last-child td { border-bottom: 0; }
#main-content .entity-list-card table tbody tr td:first-child { width: 2.5rem; padding-left: .625rem; }
#main-content .entity-list-card table tbody tr td:last-child { width: 3rem; padding-right: .625rem; }
#main-content .entity-list-card table tbody tr:hover { background: var(--fm-background); }
#main-content .entity-list-card .kebab { display: grid; width: 2rem; height: 2rem; place-items: center; padding: 0; border: 1px solid var(--fm-border); border-radius: 6px; color: var(--fm-text-secondary); }

#main-content .entity-list-card footer {
    height: auto;
    min-height: 4.5rem;
    margin: 0;
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--fm-border);
    color: var(--fm-text-secondary);
}

#main-content .entity-list-card footer span { color: var(--fm-text-secondary); font-size: .8125rem; }
#main-content .entity-list-card .pagger { gap: .25rem; }
#main-content .entity-list-card .pagger span { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 6px; color: var(--fm-text-secondary); cursor: pointer; }
#main-content .entity-list-card .pagger span.active { background: var(--fm-accent); color: #fff; font-weight: 600 !important; text-decoration: none !important; }
#main-content .entity-list-card .pagger span.dots { width: auto; padding: 0 .25rem; cursor: default; }

@media (max-width: 40rem) {
    #main-content .entity-list-heading,
    #main-content .entity-list-card#main-container { width: calc(100% - 2rem); }
    #main-content .entity-list-heading { margin-top: 1rem; }
    #main-content .entity-list-card > div > header { justify-content: stretch; }
    #main-content .entity-list-card #header-second-container { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    #main-content .entity-list-card table { width: calc(100% - 1rem); margin: .5rem; }
    #main-content .entity-list-card table th:nth-child(n + 4),
    #main-content .entity-list-card table td:nth-child(n + 4) { display: none; }
    #main-content .entity-list-card footer { padding-right: .75rem; padding-left: .75rem; }
    #main-content .entity-list-card footer > span { font-size: 0 !important; }
    #main-content .entity-list-card footer > span .material-symbols-outlined { font-size: 1rem !important; }
}
