:root {
    --orange: #ff5b35;
    --orange-dark: #e84824;
    --orange-soft: #fff0eb;
    --amber: #ff9700;
    --ink: #303038;
    --ink-soft: #5f6068;
    --muted: #858791;
    --line: #e7e7ea;
    --canvas: #f5f5f6;
    --white: #ffffff;
    --danger: #d9363e;
    --danger-soft: #fff0f1;
    --success: #1d8d5d;
    --success-soft: #eaf8f1;
    --warning: #ba7300;
    --warning-soft: #fff6df;
    --blue: #3f68d7;
    --blue-soft: #edf2ff;
    --shadow: 0 18px 50px rgba(39, 39, 48, 0.08);
    --radius: 20px;
    --font: "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }

.eyebrow {
    margin: 0 0 6px;
    color: var(--orange);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f2f2f3;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(320px, 460px) minmax(420px, 620px);
    width: min(1080px, 100%);
    min-height: 650px;
    overflow: hidden;
    border-radius: 32px;
    background: var(--white);
    box-shadow: 0 30px 90px rgba(42, 42, 49, .14);
}

.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 54px 58px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 66px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-brand img { width: 156px; height: auto; }

.login-copy h1 {
    max-width: 360px;
    margin: 0;
    font-size: clamp(34px, 4vw, 48px);
    line-height: 1.03;
    letter-spacing: -.045em;
}

.login-copy > p:last-child {
    margin: 20px 0 34px;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.6;
}

.login-form { display: grid; gap: 18px; }

.login-form label,
.filter-fields label {
    display: grid;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
}

.login-form input,
.filter-fields select,
.search-box input {
    width: 100%;
    min-height: 47px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    background: var(--white);
    color: var(--ink);
    padding: 0 14px;
    transition: border-color .18s, box-shadow .18s;
}

.login-form input:focus,
.filter-fields select:focus,
.search-box input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 4px rgba(255, 91, 53, .12);
}

.button {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    padding: 0 20px;
    font-weight: 800;
    cursor: pointer;
}

.button--primary { background: var(--orange); color: var(--white); }
.button--primary:hover { background: var(--orange-dark); }
.button--secondary { display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--white); color: var(--ink); text-decoration: none; }
.button--wide { width: 100%; margin-top: 4px; }

.login-footnote {
    margin: 32px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.login-context {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background: var(--ink);
    padding: 58px;
}

.login-context::before {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 74% 18%, rgba(255,151,0,.38), transparent 23%),
                linear-gradient(140deg, transparent 20%, rgba(255,91,53,.08));
    content: "";
}

.context-ring {
    position: absolute;
    border: 56px solid var(--orange);
    border-radius: 50%;
}

.context-ring--one { width: 410px; height: 410px; top: -96px; right: -118px; }
.context-ring--two { width: 240px; height: 240px; top: 188px; right: 108px; border-color: rgba(255,255,255,.08); }

.context-message { position: relative; z-index: 1; max-width: 430px; color: var(--white); }
.context-message span { color: #ffb19e; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.context-message strong { display: block; margin-top: 12px; font-size: 33px; line-height: 1.12; letter-spacing: -.03em; }

.flash { margin: -16px 0 22px; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.flash--erro { background: var(--danger-soft); color: var(--danger); }

.app-page { background: var(--canvas); }
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    display: flex;
    width: 238px;
    flex-direction: column;
    background: var(--ink);
    color: var(--white);
    padding: 28px 18px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 8px 38px;
    color: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: .08em;
    text-decoration: none;
    text-transform: uppercase;
}

.sidebar-brand img {
    width: 116px;
    height: auto;
    border-radius: 2px;
    filter: brightness(0) invert(1);
}

.side-nav { display: grid; gap: 7px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #c8c8ce;
    padding: 0 13px;
    text-align: left;
    cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: var(--white); }
.nav-item.is-active { background: var(--orange); color: var(--white); }
.nav-icon { display: grid; width: 22px; place-items: center; font-size: 18px; }

.sidebar-logout { margin-top: auto; }
.logs-link { display: block; margin-bottom: 9px; color: #c8c8ce; font-size: 11px; text-align: center; text-decoration: none; }
.logs-link:hover { color: var(--white); }
.logout-button { width: 100%; border: 1px solid rgba(255,255,255,.14); border-radius: 11px; background: transparent; color: #d9d9de; padding: 11px; cursor: pointer; }

.main-content {
    width: calc(100% - 238px);
    max-width: 1500px;
    min-height: 100vh;
    margin-left: 238px;
    padding: 34px 42px 70px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.topbar h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.035em; }
.page-subtitle { margin: 7px 0 0; color: var(--ink-soft); font-size: 14px; }

.icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    place-items: center;
    background: var(--white);
    color: var(--ink);
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(39,39,48,.05);
}

.icon-button:hover { border-color: var(--orange); color: var(--orange); }
.icon-button.is-spinning { animation: rotate .8s linear infinite; }

.filters {
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.84);
    padding: 14px;
}

.filter-head { display: flex; align-items: center; justify-content: space-between; }
.filter-toggle { display: none; border: 0; background: transparent; padding: 4px 0; font-weight: 800; cursor: pointer; }
.filter-count { display: inline-grid; min-width: 20px; height: 20px; margin-left: 6px; border-radius: 10px; place-items: center; background: var(--orange); color: white; font-size: 11px; }
.text-button { border: 0; background: transparent; color: var(--orange); font-size: 12px; font-weight: 800; cursor: pointer; }
.filter-fields { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 12px; }
.filter-fields select { min-height: 42px; padding-right: 34px; }

.view-content { display: grid; gap: 22px; }
.loading-state, .empty-state, .error-state {
    display: grid;
    min-height: 260px;
    place-items: center;
    align-content: center;
    gap: 12px;
    border: 1px dashed #d8d8dc;
    border-radius: var(--radius);
    background: rgba(255,255,255,.5);
    color: var(--muted);
    text-align: center;
}
.error-code { margin: 0; border-radius: 10px; background: var(--danger-soft); color: var(--danger); padding: 9px 12px; font-size: 11px; line-height: 1.5; }
.error-code span { color: var(--ink-soft); }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }

.spinner { width: 28px; height: 28px; border: 3px solid #e1e1e4; border-top-color: var(--orange); border-radius: 50%; animation: rotate .7s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card { position: relative; overflow: hidden; min-height: 132px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 19px; box-shadow: 0 8px 25px rgba(39,39,48,.035); }
.kpi-card::after { position: absolute; width: 64px; height: 64px; top: -28px; right: -22px; border: 12px solid var(--tone, var(--orange)); border-radius: 50%; opacity: .16; content: ""; }
.kpi-label { display: block; max-width: 145px; color: var(--ink-soft); font-size: 12px; font-weight: 700; line-height: 1.35; }
.kpi-value { display: block; margin-top: 15px; font-size: 31px; font-weight: 800; letter-spacing: -.035em; }
.kpi-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.tone-danger { --tone: var(--danger); }
.tone-warning { --tone: var(--amber); }
.tone-blue { --tone: var(--blue); }
.tone-success { --tone: var(--success); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(310px, .8fr); gap: 18px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: 0 8px 24px rgba(39,39,48,.035); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 20px 14px; }
.panel-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.panel-body { padding: 0 20px 20px; }
.panel-link { border: 0; background: transparent; color: var(--orange); font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap; }

.stage-list { display: grid; gap: 13px; }
.stage-row { display: grid; grid-template-columns: minmax(130px, .72fr) minmax(180px, 1.5fr) 56px; align-items: center; gap: 13px; }
.stage-name { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.stage-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.bar-track { height: 9px; overflow: hidden; border-radius: 6px; background: #eeeef1; }
.bar-fill { height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--amber)); }
.stage-count { color: var(--ink-soft); font-size: 12px; text-align: right; }

.attention-list, .activity-list, .compact-list { display: grid; gap: 1px; }
.opportunity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    width: 100%;
    border: 0;
    border-top: 1px solid #eeeeF0;
    background: transparent;
    padding: 14px 0;
    text-align: left;
    cursor: pointer;
}
.opportunity-row:first-child { border-top: 0; }
.opportunity-row:hover .row-title { color: var(--orange); }
.row-title { display: block; overflow: hidden; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.row-side { align-self: center; color: var(--ink-soft); font-size: 11px; text-align: right; }

.badge-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; border-radius: 11px; padding: 3px 8px; background: #f0f0f2; color: var(--ink-soft); font-size: 10px; font-weight: 800; }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--orange { background: var(--orange-soft); color: var(--orange-dark); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }

.section-title { margin: 4px 0 -8px; font-size: 15px; }
.stage-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }
.stage-card { border: 1px solid var(--line); border-radius: 18px; background: var(--white); padding: 18px; }
.stage-card-head { display: flex; justify-content: space-between; gap: 12px; }
.stage-order { color: var(--orange); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.stage-card h3 { margin: 6px 0 0; font-size: 15px; }
.stage-card strong { font-size: 30px; letter-spacing: -.04em; }
.stage-card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.mini-metric { border-radius: 10px; background: var(--canvas); padding: 9px; }
.mini-metric span { display: block; color: var(--muted); font-size: 9px; line-height: 1.2; }
.mini-metric b { display: block; margin-top: 4px; font-size: 12px; }

.table-wrap { overflow-x: auto; padding: 0 20px 20px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { border-bottom: 1px solid var(--line); color: var(--muted); padding: 10px 8px; font-size: 10px; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { border-bottom: 1px solid #f0f0f2; padding: 12px 8px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #fff9f6; }
.number-cell { text-align: right; white-space: nowrap; }
.name-cell strong { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell small { display: block; margin-top: 4px; color: var(--muted); }

.summary-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.summary-pill { flex: 0 0 auto; min-width: 132px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); padding: 13px 15px; }
.summary-pill span { display: block; color: var(--muted); font-size: 10px; }
.summary-pill strong { display: block; margin-top: 4px; font-size: 20px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search-box { flex: 1; max-width: 520px; }
.search-box input { min-height: 44px; }
.pagination { display: flex; align-items: center; gap: 8px; }
.pagination button { border: 1px solid var(--line); border-radius: 9px; background: var(--white); padding: 8px 11px; cursor: pointer; }
.pagination button:disabled { opacity: .4; cursor: default; }

.consultant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.consultant-card { border: 1px solid var(--line); border-radius: 18px; background: var(--white); padding: 17px; }
.consultant-head { display: flex; align-items: center; gap: 12px; }
.avatar { display: grid; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; place-items: center; background: var(--orange-soft); color: var(--orange-dark); font-weight: 900; }
.consultant-head h3 { margin: 0; font-size: 14px; }
.consultant-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.consultant-score { margin-left: auto; font-size: 26px; font-weight: 800; }
.consultant-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 15px; }

.drawer, .sheet { position: fixed; z-index: 90; inset: 0; }
.drawer[hidden], .sheet[hidden], .toast[hidden] { display: none; }
.drawer-backdrop, .sheet-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(30,30,35,.48); backdrop-filter: blur(3px); }
.drawer-panel { position: absolute; inset: 0 0 0 auto; width: min(620px, 100%); overflow-y: auto; background: var(--canvas); box-shadow: -20px 0 50px rgba(0,0,0,.15); animation: slideIn .22s ease-out; }
@keyframes slideIn { from { transform: translateX(35px); opacity: .4; } }
.drawer-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); padding: 18px 22px; backdrop-filter: blur(10px); }
.drawer-header h2 { margin: 0; font-size: 21px; }
.drawer-content { display: grid; gap: 16px; padding: 20px; }
.detail-hero { border-radius: 20px; background: var(--ink); color: var(--white); padding: 22px; }
.detail-hero h3 { margin: 0; font-size: 23px; line-height: 1.12; }
.detail-hero p { margin: 9px 0 0; color: #c8c8ce; font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.detail-field { border: 1px solid var(--line); border-radius: 13px; background: var(--white); padding: 12px; }
.detail-field span { display: block; color: var(--muted); font-size: 10px; }
.detail-field strong { display: block; margin-top: 5px; font-size: 13px; }
.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; margin-left: 8px; border-left: 2px solid #e2e2e6; padding: 0 0 20px 21px; }
.timeline-item::before { position: absolute; width: 10px; height: 10px; top: 4px; left: -6px; border: 2px solid var(--white); border-radius: 50%; background: var(--orange); content: ""; }
.timeline-item:last-child { border-color: transparent; }
.timeline-item strong { display: block; font-size: 12px; }
.timeline-item p { margin: 5px 0; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.timeline-item time { color: var(--muted); font-size: 10px; }

.bottom-nav, .sheet { display: none; }
.toast { position: fixed; z-index: 120; right: 24px; bottom: 24px; max-width: 360px; border-radius: 12px; background: var(--ink); color: var(--white); padding: 13px 16px; box-shadow: var(--shadow); font-size: 12px; }

.log-page { min-height: 100vh; padding: 30px; background: var(--canvas); }
.log-shell { width: min(1400px, 100%); margin: 0 auto; }
.log-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.log-header h1 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.log-header p:last-child { margin: 7px 0 0; color: var(--ink-soft); font-size: 13px; }
.log-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); padding: 15px 17px; }
.log-status.is-ok { border-left: 5px solid var(--success); }
.log-status.is-error { border-left: 5px solid var(--danger); }
.log-status strong, .log-status code { display: block; }
.log-status code { margin-top: 5px; color: var(--muted); font-size: 11px; word-break: break-all; }
.log-message { margin-top: 12px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); padding: 12px 14px; font-size: 12px; }
.log-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 15px; margin-top: 15px; }
.log-files, .log-viewer { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.log-files { padding: 14px; }
.log-files h2 { margin: 3px 4px 12px; font-size: 15px; }
.log-files > p { color: var(--muted); font-size: 12px; }
.log-file { display: block; border-radius: 10px; color: var(--ink); padding: 10px; text-decoration: none; }
.log-file:hover, .log-file.is-active { background: var(--orange-soft); }
.log-file strong, .log-file span { display: block; }
.log-file strong { font-size: 11px; }
.log-file span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.log-viewer header { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.log-viewer header strong { font-size: 12px; }
.log-viewer pre { min-height: 520px; max-height: 72vh; margin: 0; overflow: auto; background: #29292f; color: #efeff2; padding: 18px; font: 11px/1.55 Consolas, "Courier New", monospace; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 1100px) {
    .main-content { padding-inline: 28px; }
    .filter-fields { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .login-page { padding: 0; background: var(--white); }
    .login-shell { display: block; min-height: 100vh; border-radius: 0; box-shadow: none; }
    .login-card { min-height: 100vh; padding: 32px 24px; }
    .login-brand { margin-bottom: 58px; }
    .login-context { display: none; }

    .sidebar { display: none; }
    .main-content { width: 100%; margin: 0; padding: 22px 16px 98px; }
    .topbar { margin-bottom: 18px; }
    .topbar h1 { font-size: 28px; }
    .page-subtitle { max-width: 290px; font-size: 12px; }

    .filters { padding: 12px 14px; }
    .filter-toggle { display: block; }
    .filter-fields { display: none; grid-template-columns: 1fr 1fr; margin-top: 14px; }
    .filters.is-open .filter-fields { display: grid; }

    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi-card { min-height: 118px; border-radius: 17px; padding: 15px; }
    .kpi-value { margin-top: 12px; font-size: 27px; }
    .content-grid { gap: 14px; }
    .panel { border-radius: 17px; }
    .panel-head { padding: 17px 16px 12px; }
    .panel-body { padding: 0 16px 17px; }
    .stage-row { grid-template-columns: 105px minmax(110px, 1fr) 43px; gap: 9px; }

    .table-wrap { padding: 0 12px 14px; }
    .data-table th, .data-table td { padding-inline: 7px; }
    .mobile-hide { display: none; }
    .stage-cards { grid-template-columns: 1fr; }
    .consultant-grid { grid-template-columns: 1fr; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search-box { max-width: none; }

    .bottom-nav {
        position: fixed;
        z-index: 50;
        inset: auto 0 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        border-top: 1px solid var(--line);
        background: rgba(255,255,255,.95);
        padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        box-shadow: 0 -8px 30px rgba(39,39,48,.08);
        backdrop-filter: blur(12px);
    }

    .mobile-nav-item { display: grid; gap: 2px; border: 0; background: transparent; color: var(--muted); place-items: center; padding: 3px; cursor: pointer; }
    .mobile-nav-item span { font-size: 19px; line-height: 1; }
    .mobile-nav-item small { font-size: 9px; font-weight: 700; }
    .mobile-nav-item.is-active { color: var(--orange); }

    .sheet { display: block; }
    .sheet-panel { position: absolute; inset: auto 0 0; border-radius: 24px 24px 0 0; background: var(--white); padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); animation: rise .2s ease-out; }
    @keyframes rise { from { transform: translateY(30px); opacity: .5; } }
    .sheet-handle { width: 42px; height: 4px; margin: 0 auto 18px; border-radius: 2px; background: #d8d8dc; }
    .sheet-panel h2 { margin: 0 0 12px; font-size: 19px; }
    .sheet-link { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; border: 0; border-top: 1px solid #ededf0; background: transparent; color: inherit; padding: 0; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; }
    .sheet-link--danger { color: var(--danger); }

    .drawer-panel { width: 100%; }
    .drawer-header { padding: 15px 17px; }
    .drawer-content { padding: 15px; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .toast { right: 14px; bottom: 82px; left: 14px; max-width: none; }
    .log-page { padding: 18px 12px; }
    .log-header, .log-status { align-items: stretch; flex-direction: column; }
    .log-grid { grid-template-columns: 1fr; }
    .log-viewer pre { min-height: 430px; }
}

@media (max-width: 400px) {
    .main-content { padding-inline: 12px; }
    .filter-fields { grid-template-columns: 1fr; }
    .kpi-label { font-size: 11px; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
