:root {
    color-scheme: light;
    --ink: #272328; --muted: #655f66; --surface: #fff; --canvas: #f7f6f6;
    --line: #e6e0e2; --wine: #620812; --red: #a31d28; --rose: #f9edef;
    font: 15px/1.5 "Inter", system-ui, sans-serif; color: var(--ink); background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 3vw, 2.05rem); line-height: 1.15; letter-spacing: -.038em; }
h2 { font-size: 1.04rem; line-height: 1.35; }
a { color: var(--wine); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid #b02540; outline-offset: 3px; }
.muted, .page-heading p, .feature p, .empty p { color: var(--muted); }
.brand { font-size: 1rem; font-weight: 500; letter-spacing: .13em; text-decoration: none; }
.brand strong { font-weight: 800; }
.button {
    min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
    padding: .46rem .85rem; border: 1px solid var(--line); border-radius: .45rem;
    background: white; color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--rose); border-color: #d3a8ad; }
.button.primary { color: white; background: var(--red); border-color: var(--red); }
.button.primary:hover { background: var(--wine); border-color: var(--wine); }
.button.quiet { background: transparent; border-color: transparent; }
.button.quiet:hover { background: var(--rose); }
.button.danger { color: var(--red); }
.button:disabled { opacity: .55; cursor: default; }
.login-layout { display: grid; grid-template-columns: minmax(330px, 44%) 1fr; min-height: 100svh; background: #fff; }
.login-brand {
    position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between;
    overflow: hidden; padding: clamp(2rem, 6vw, 5rem); color: #fff; background: linear-gradient(145deg, #310b14, var(--wine) 56%, #8b1624);
}
.login-brand::before, .login-brand::after {
    content: ""; position: absolute; z-index: -1; width: 110%; aspect-ratio: 1; top: 16%; left: 26%;
    border: 1px solid #ffffff26; border-radius: 50%; pointer-events: none;
}
.login-brand::after { top: 22%; left: 13%; }
.login-brand .brand { font-size: clamp(1rem, 2vw, 1.35rem); }
.login-brand-copy p { max-width: 14ch; font-size: clamp(2.15rem, 4vw, 4.35rem); line-height: 1.02; font-weight: 720; letter-spacing: -.055em; }
.login-panel { display: grid; align-items: center; justify-items: center; padding: 2rem; }
.login-content { width: min(100%, 370px); }
.login-form { display: grid; gap: 1rem; margin-top: 1.65rem; }
.login-form .button { margin-top: .25rem; }
.portal-profiles { border: 0; margin: 0; padding: 0; min-width: 0; }
.portal-profiles legend { padding: 0 0 .35rem; }
.portal-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.portal-option { position: relative; }
.portal-option input[type=radio] { position: absolute; width: 1px; min-height: 0; height: 1px; padding: 0; opacity: 0; }
.portal-option .button { gap: .42rem; padding-inline: .45rem; margin-top: 0; }
.portal-option svg { width: 1.15rem; height: 1.15rem; flex: none; }
.portal-option input:checked + .button { border-color: var(--red); color: var(--wine); background: var(--rose); }
.portal-option input:focus-visible + .button { outline: 2px solid var(--red); outline-offset: 3px; }
label, legend { font-weight: 620; }
label { display: grid; gap: .3rem; min-width: 0; }
input:not([type=checkbox]), select, textarea {
    min-height: 40px; padding: .48rem .65rem; width: 100%; min-width: 0;
    border: 1px solid #d7cfd2; border-radius: .4rem; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
.workspace {
    --ink: #25262b; --muted: #555c68; --canvas: #f4f5f6; --line: #e0e3e8;
    --sidebar-width: 234px;
    display: grid; grid-template-areas: "topbar topbar" "sidebar page";
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: auto 1fr; min-height: 100svh;
    background: var(--canvas); color: var(--ink);
    font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}
.workspace:has(.workspace-menu:not([open])) { --sidebar-width: 68px; }
.app-icon { display: block; width: 1.2rem; height: 1.2rem; flex: none; }
.topbar {
    grid-area: topbar; position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between; gap: .65rem;
    min-height: 64px; padding: .55rem clamp(.75rem, 2vw, 1.6rem);
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-identity, .topbar-exit { display: flex; align-items: center; gap: .65rem; }
.workspace-menu summary { list-style: none; width: 40px; padding: 0; color: var(--muted); }
.workspace-menu summary::-webkit-details-marker { display: none; }
.workspace-brand { text-decoration: none; color: var(--ink); font-weight: 720; white-space: nowrap; }
.topbar-profile {
    margin-left: .6rem; padding-left: 1rem; border-left: 1px solid var(--line);
    color: var(--muted); font-size: .88rem;
}
.topbar-exit { gap: .38rem; color: var(--muted); }
.sidebar { grid-area: sidebar; background: var(--surface); border-right: 1px solid var(--line); padding: .95rem .65rem; }
.sidebar nav, .sidebar-group { display: grid; gap: .3rem; }
.sidebar-group { margin-top: .45rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.sidebar nav a {
    display: flex; align-items: center; gap: .72rem; min-height: 44px;
    padding: .55rem .75rem; border-radius: .62rem; color: var(--muted);
    font-size: .94rem; font-weight: 590; text-decoration: none; white-space: nowrap;
}
.sidebar nav a:hover { background: var(--canvas); color: var(--ink); }
.sidebar nav a.active { background: var(--rose); color: var(--wine); font-weight: 680; }
.workspace:has(.workspace-menu:not([open])) .sidebar nav a { justify-content: center; padding-inline: 0; }
.workspace:has(.workspace-menu:not([open])) .sidebar nav a span { display: none; }
.page { grid-area: page; min-width: 0; padding: clamp(1rem, 2.45vw, 2.35rem); }
.page-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 1.55rem; padding-bottom: 1.15rem; border-bottom: 1px solid var(--line);
}
.page-heading p { margin-top: .38rem; }
.workspace .button, .workspace input:not([type=checkbox]):not([type=hidden]),
.workspace select, .workspace textarea { border-radius: .62rem; }
.workspace input:not([type=checkbox]):not([type=hidden]), .workspace select, .workspace textarea { border-color: #d6dbe2; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; box-shadow: 0 2px 5px #20273309; }
.kpi-grid, .feature-grid, .shortcut-grid { display: grid; gap: .85rem; }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); margin-bottom: 1.2rem; }
.kpi, .feature { padding: 1rem 1.15rem; }
.kpi { display: flex; flex-direction: column; justify-content: space-between; gap: .8rem; min-height: 116px; }
.kpi-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .42rem; }
.kpi h2 { color: var(--muted); font-size: .87rem; font-weight: 590; padding-top: .2rem; }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: .5rem; background: var(--rose); color: var(--red); }
.kpi-icon .app-icon { width: 1rem; height: 1rem; }
.kpi strong { font-size: 1.95rem; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.feature p { margin-top: .4rem; font-size: .92rem; }
.shortcuts { padding: 1.15rem; }
.shortcut-grid { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); margin-top: .8rem; }
.shortcut-grid a { display: flex; align-items: center; justify-content: space-between; gap: .45rem; padding: .75rem; border: 1px solid var(--line); border-radius: .62rem; text-decoration: none; }
.shortcut-grid .app-icon { width: .95rem; height: .95rem; }
.shortcut-grid a:hover { background: var(--rose); }
.shortcuts > p { margin-top: 1rem; }
.notice { margin: .8rem 0; padding: .65rem .85rem; border-radius: .4rem; }
.notice.error { color: var(--wine); background: var(--rose); }
.notice.success { color: #184432; background: #e7f4ed; }
.editor { padding: 1.15rem; margin-bottom: 1rem; }
.editor > h2 { margin-bottom: .85rem; }
.editor.cadastro-dialog {
    width: min(40rem, calc(100% - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: clamp(1rem, 3vw, 1.5rem);
    overflow: auto;
    overscroll-behavior: contain;
    color: var(--ink);
    box-shadow: 0 18px 64px #25262b38;
}
.cadastro-dialog::backdrop { background: #25262b70; }
body:has(.cadastro-dialog[open]) { overflow: hidden; }
.fields, .details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.05rem; }
.wide { grid-column: 1 / -1; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: .45rem; padding: .55rem .8rem; }
.check { display: flex; align-items: center; gap: .5rem; align-self: center; min-height: 36px; }
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--red); }
.details { margin: 0; }
.details dt { color: var(--muted); font-size: .85rem; }
.details dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1.15rem; }
.filters { display: flex; align-items: flex-end; gap: .7rem; flex-wrap: wrap; padding: .9rem; }
.filters input, .filters select, .filters > .button { height: 42px; min-height: 42px; }
.filters > label:first-child { flex: 1 1 200px; }
.filters > label:not(:first-child) { flex: 0 1 155px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .48rem .85rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
thead { color: var(--muted); background: #fbfafb; font-size: .86rem; }
.row-actions { white-space: nowrap; }
.row-actions .button { min-height: 36px; padding: .35rem .7rem; margin: .15rem .25rem .15rem 0; font-size: .85rem; border: 1px solid #d6dbe2; background: #fff; box-shadow: 0 1px 2px #25262b08; }
.row-actions .button:hover { color: var(--wine); border-color: #d3a8ad; background: var(--rose); }
.row-actions .button.danger { color: var(--red); border-color: #ebc5ca; background: #fff5f6; }
.row-actions .button.danger:hover { background: #f9e4e7; border-color: var(--red); }
.status { display: inline-block; padding: .13rem .5rem; border-radius: 1rem; font-size: .82rem; font-weight: 650; }
.status.active { color: #184432; background: #e7f4ed; }
.status.inactive { color: #514952; background: #f0edef; }
.empty { padding: 2rem 1rem; text-align: center; border-top: 1px solid var(--line); }
.empty p { margin-top: .35rem; }
.sidebar-section { margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .65rem; }
.sidebar-section > summary { cursor: pointer; padding: .55rem; font-weight: 650; font-size: .9rem; color: var(--muted); }
.sidebar-section > a { padding-left: 1rem; }
.sport-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.sport-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.sport-row:last-child { border-bottom: 0; }
.sport-row > div { min-width: 0; overflow-wrap: anywhere; }
.sport-card { padding: 1.2rem; margin: 1rem 0; }
.sport-card .sport-row { padding: 0 0 1rem; margin-bottom: 1rem; }
.sport-kpis { margin: 1rem 0; }
.sport-actions { justify-content: flex-start; }
.history-entry { padding: 1rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.history-entry p { white-space: pre-wrap; margin: .35rem 0; }
.cadastro-dialog h3 { margin: 1rem 0 .5rem; font-size: .95rem; }
.progress-chart { margin: 1rem 0; padding: .7rem; background: var(--canvas); border-radius: .6rem; }
.progress-chart svg { display: block; width: 100%; max-height: 130px; }
@media(max-width:560px) {
    .sport-row { align-items: flex-start; flex-direction: column; }
    .sport-actions > .button { flex: 1 1 45%; }
    .sport-tabs > .button { flex: 1 1 40%; }
}
@media (max-width: 800px) {
    .workspace { grid-template-areas: "topbar" "sidebar" "page"; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: .5rem .75rem; }
    .sidebar nav, .sidebar-group { display: flex; flex-wrap: wrap; }
    .sidebar-group { margin: 0; padding: 0; border: 0; }
    .sidebar nav a { min-height: 40px; font-size: .88rem; }
    .workspace:has(.workspace-menu:not([open])) .sidebar { display: none; }
}
@media (max-width: 560px) {
    .login-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .login-brand { padding: 1.3rem 1.45rem; min-height: 150px; gap: .9rem; }
    .login-brand-copy p { max-width: none; font-size: 1.6rem; }
    .login-panel { align-items: start; padding: 1.65rem 1.35rem; }
    .topbar-profile { display: none; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .fields, .details { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi { padding: .8rem; }
    .listing table { display: block; }
    .listing thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
    .listing tbody, .listing tr { display: block; }
    .listing tr { padding: .6rem .85rem; border-top: 1px solid var(--line); }
    .listing th, .listing td { display: block; border: 0; padding: .15rem 0; }
    .row-actions { display: flex !important; flex-wrap: wrap; gap: .2rem; }
}
