:root {
    color-scheme: light;
    --brand-red: #ff0000;
    --brand-red-dark: #d90000;
    --brand-red-soft: #fff0f0;
    --brand-black: #131417;
    --brand-black-soft: #202125;
    --ink: #191a1d;
    --muted: #6d7078;
    --paper: #f4f5f7;
    --card: #ffffff;
    --line: #e7e8eb;
    --success: #159447;
    --success-soft: #eaf7ef;
    --warning: #b96712;
    --warning-soft: #fff4e8;
    --danger: #bd2424;
    --shadow-sm: 0 8px 25px rgba(19, 20, 23, .055);
    --shadow-md: 0 18px 50px rgba(19, 20, 23, .10);
    font-family: "Urbanist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { font-family: "SFMono-Regular", Consolas, monospace; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(32px, 4vw, 48px); font-weight: 800; line-height: .98; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 23px; font-weight: 800; line-height: 1.15; letter-spacing: -.025em; }

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 0, 0, .17), transparent 25%),
        radial-gradient(circle at 92% 92%, rgba(255, 255, 255, .08), transparent 28%),
        var(--brand-black);
}
.login-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .2;
    background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom right, black, transparent 70%);
}
.login-card {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    padding: 42px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 24px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 30px 90px rgba(0,0,0,.35);
}
.login-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 110px;
    height: 5px;
    background: var(--brand-red);
}
.official-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.login-logo-wrap {
    display: grid;
    place-items: center;
    width: 86px;
    height: 94px;
    margin-bottom: 25px;
    padding: 8px;
    border-radius: 17px;
    background: var(--brand-black);
    box-shadow: 0 12px 28px rgba(19,20,23,.18);
}
.login-logo { width: 61px; height: 70px; }
.eyebrow { margin-bottom: 7px; color: var(--brand-red); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.6; }
.stack { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 8px; color: #34363b; font-size: 13px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid #d9dbe0;
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
textarea { resize: vertical; }
input::placeholder { color: #a4a7ae; }
input:hover, select:hover, textarea:hover { border-color: #c2c5cb; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-red); box-shadow: 0 0 0 4px rgba(255, 0, 0, .10); }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 800;
    text-decoration: none;
    transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: linear-gradient(135deg, var(--brand-red), #e50000); color: #fff; box-shadow: 0 8px 22px rgba(255,0,0,.18); }
.button-primary:hover { background: linear-gradient(135deg, #e90000, var(--brand-red-dark)); box-shadow: 0 10px 26px rgba(255,0,0,.24); }
.button-secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button-secondary:hover { border-color: #cfd1d6; background: #f8f8f9; }
.button-small { min-height: 34px; padding: 0 13px; font-size: 12px; }
.button-dark { background: var(--brand-black); color: #fff; box-shadow: 0 6px 16px rgba(19,20,23,.14); }
.button-dark:hover { background: #292a2f; box-shadow: 0 8px 20px rgba(19,20,23,.2); }
.button-danger-outline { border-color: #efc7c7; background: #fff; color: var(--danger); }
.button-danger-outline:hover { border-color: var(--danger); background: #fff3f3; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.app-shell { min-height: 100vh; padding-left: 268px; }
.sidebar {
    position: fixed;
    z-index: 10;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: 268px;
    padding: 28px 20px 22px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 10% 3%, rgba(255,0,0,.18), transparent 24%),
        linear-gradient(160deg, var(--brand-black-soft), var(--brand-black) 60%);
    color: #fff;
}
.sidebar::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: var(--brand-red);
}
.brand { display: flex; align-items: center; gap: 14px; padding: 0 7px 30px; text-decoration: none; }
.brand-logo-wrap { display: block; flex: 0 0 50px; width: 50px; height: 58px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: #9c9fa7; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #c5c7cd;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { border-color: rgba(255,255,255,.08); background: rgba(255,255,255,.11); color: #fff; box-shadow: inset 3px 0 0 var(--brand-red); }
.nav-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: rgba(255,255,255,.07); color: #fff; font-size: 17px; line-height: 1; }
.nav-icon svg { width: 16px; height: 16px; fill: currentColor; }
.sidebar nav a.active .nav-icon { background: var(--brand-red); }
.logout-form { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.10); color: #a9abb1; font-size: 13px; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--brand-red); font-weight: 800; }
.link-button:hover { color: var(--brand-red-dark); text-decoration: underline; }
.sidebar .link-button { color: #fff; }

.content { width: 100%; max-width: none; margin: 0; padding: 32px clamp(18px, 2vw, 32px) 60px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-header-actions { display: flex; align-items: flex-end; justify-content: flex-end; flex-wrap: wrap; gap: 11px; }
.period-filter { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; }
.period-filter label { min-width: 135px; }
.period-filter label:first-of-type { min-width: 175px; }
.period-filter input, .period-filter select { min-height: 40px; padding: 8px 11px; background: #fff; }
.period-filter .button { min-height: 40px; }
.status-pill, .badge { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; font-size: 12px; font-weight: 800; text-decoration: none; }
.status-pill { gap: 8px; padding: 9px 13px; border: 1px solid #dce9df; background: #fff; color: #287641; box-shadow: 0 6px 18px rgba(19,20,23,.05); }
.status-pill:hover { border-color: #b9d6c0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #20b85a; box-shadow: 0 0 0 4px rgba(32,184,90,.12); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 22px; }
.metrics article {
    position: relative;
    min-height: 156px;
    padding: 21px 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.metrics article:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metrics article::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--brand-red); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; }
.metrics article:hover::after, .metrics .metric-featured::after { transform: scaleX(1); }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-head > span, .metrics small { color: var(--muted); }
.metric-head > span { font-size: 13px; font-weight: 700; }
.metric-head i { display: grid; place-items: center; min-width: 35px; height: 35px; padding: 0 8px; border-radius: 10px; background: var(--brand-red-soft); color: var(--brand-red); font-size: 13px; font-style: normal; font-weight: 900; }
.metric-head i svg { width: 17px; height: 17px; fill: currentColor; }
.metric-head i.online { color: var(--success); background: var(--success-soft); font-size: 11px; }
.metrics strong { display: block; margin: 16px 0 5px; font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.metrics small { display: block; font-size: 12px; font-weight: 500; }
.metric-featured { background: linear-gradient(145deg, #fff, #fff7f7) !important; }

.panel { margin-bottom: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow-sm); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 23px 25px; border-bottom: 1px solid var(--line); }
.panel-heading > span { padding: 6px 10px; border-radius: 999px; background: #f3f4f5; color: var(--muted); font-size: 12px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 2fr auto; align-items: end; gap: 14px; padding: 23px 25px 25px; }
.client-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 16px; padding: 24px 25px 27px; }
.client-form-wide { grid-column: 1 / -1; }
.client-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.client-check { display: flex; align-items: center; align-self: center; grid-template-columns: auto 1fr; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fafafa; }
.client-check input { width: 18px; min-height: 18px; accent-color: var(--brand-red); }
.client-overview { display: grid; grid-template-columns: minmax(260px, .8fr) 2fr; gap: 22px; margin-bottom: 22px; padding: 27px; border-radius: 20px; background: linear-gradient(145deg, var(--brand-black-soft), var(--brand-black)); color: #fff; box-shadow: var(--shadow-md); }
.client-overview .muted { margin-bottom: 0; color: #bfc1c7; }
.client-overview-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.client-overview-stats article { padding: 17px; border: 1px solid rgba(255,255,255,.10); border-radius: 14px; background: rgba(255,255,255,.06); }
.client-overview-stats span, .client-overview-stats strong { display: block; }
.client-overview-stats span { margin-bottom: 8px; color: #aaaeb6; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.client-overview-stats strong { font-size: 18px; }
.client-overview-stats small { display: block; margin-top: 5px; color: #8f939c; font-size: 10px; }
.client-edit-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 25px; cursor: pointer; list-style: none; }
.client-edit-details > summary::-webkit-details-marker { display: none; }
.client-edit-details > summary span:first-child small, .client-edit-details > summary span:first-child strong { display: block; }
.client-edit-details > summary span:first-child small { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.client-edit-details[open] > summary { border-bottom: 1px solid var(--line); }
.details-open-label { display: none; }
.client-edit-details[open] > summary .details-closed-label { display: none; }
.client-edit-details[open] > summary .details-open-label { display: inline; }
.create-client-details { margin-bottom: 22px; }
.report-header-card { overflow: hidden; }
.report-header-card .panel-heading { align-items: flex-start; }
.report-description { max-width: 720px; margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.report-export-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.button-excel { border-color: #176b43; background: #176b43; color: #fff; }
.button-excel:hover { border-color: #105536; background: #105536; color: #fff; }
.report-filters { display: grid; grid-template-columns: 1.25fr 1.15fr repeat(4, minmax(145px, 1fr)) auto; align-items: end; gap: 12px; padding: 20px 24px 24px; border-top: 1px solid var(--line); background: #fafafb; }
.report-filters label { min-width: 0; }
.report-filters .button { min-height: 45px; white-space: nowrap; }
.report-table-card { overflow: hidden; }
.inline-management-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 14px; padding: 22px 25px; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.assignment-help { margin: 0; padding: 13px 25px; border-bottom: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; line-height: 1.55; }
.assignment-help strong { color: var(--ink); }
.client-management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.client-management-single { display: grid; grid-template-columns: minmax(0, 1fr); }
.machine-location-form { display: grid; grid-template-columns: 1fr 2fr 1fr 90px 130px auto; align-items: end; gap: 14px; padding: 23px 25px 25px; }
.machine-location-form .button { min-height: 45px; white-space: nowrap; }
.management-stack { padding: 0 24px 24px; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.management-list { border-top: 1px solid var(--line); }
.management-list > div:not(.empty) { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 24px; border-bottom: 1px solid var(--line); }
.management-list > div:last-child { border-bottom: 0; }
.management-list strong, .management-list small { display: block; }
.management-list small { margin-top: 3px; color: var(--muted); }
.form-hint { margin-top: -7px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.client-user-actions, .client-password-form { display: flex; align-items: center; gap: 8px; }
.client-user-actions form { margin: 0; }
.client-password-form input { width: 185px; min-height: 36px; padding: 7px 10px; border-radius: 9px; font-size: 12px; }
.client-user-edit { position: relative; }
.client-user-edit > summary { list-style: none; cursor: pointer; }
.client-user-edit > summary::-webkit-details-marker { display: none; }
.client-user-edit-form { position: absolute; z-index: 12; top: 43px; right: 0; display: grid; width: 310px; gap: 11px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-md); }
.client-user-edit-form .client-check { min-height: 40px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 13px 17px; background: #f7f7f8; color: #777a82; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 16px 17px; border-top: 1px solid #ededf0; vertical-align: middle; }
td strong { font-weight: 800; }
td small { display: block; max-width: 290px; margin-top: 4px; color: var(--muted); font-size: 12px; }
tbody tr { transition: background-color .16s ease; }
tbody tr:hover td { background: #fafafb; }
.badge { padding: 6px 10px; }
.badge-success { background: var(--success-soft); color: #19733a; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: #fff0f0; color: var(--danger); }
.badge-muted { background: #ededee; color: #656870; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; white-space: nowrap; }
.actions form { margin: 0; }
.empty { padding: 44px; color: var(--muted); text-align: center; }
.filter-panel { padding: 19px 21px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.filters label { min-width: 220px; }
.filters label:nth-of-type(2) { flex: 1; }
.alert { margin-bottom: 19px; padding: 15px 17px; border: 1px solid; border-radius: 13px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.alert-success { border-color: #c8e4d0; background: var(--success-soft); color: #24673b; }
.alert-error { border-color: #f0caca; background: #fff0f0; color: var(--danger); }
.token-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.token-row code { flex: 1; overflow-wrap: anywhere; padding: 11px 13px; border-radius: 9px; background: rgba(255,255,255,.82); color: #29312c; }

.back-link { display: inline-flex; margin: -12px 0 18px; color: var(--muted); font-size: 13px; font-weight: 800; text-decoration: none; }
.back-link:hover { color: var(--brand-red); }
.machine-overview {
    margin-bottom: 22px;
    padding: 25px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 95% 5%, rgba(255,0,0,.2), transparent 25%),
        linear-gradient(145deg, var(--brand-black-soft), var(--brand-black));
    color: #fff;
    box-shadow: var(--shadow-md);
}
.machine-identity { display: flex; align-items: center; gap: 18px; }
.machine-avatar { display: grid; place-items: center; flex: 0 0 62px; width: 62px; height: 62px; border-radius: 17px; background: var(--brand-red); color: #fff; font-size: 20px; font-weight: 900; letter-spacing: -.04em; }
.machine-title-row { display: flex; align-items: center; gap: 10px; }
.machine-title-row h2 { font-size: 29px; }
.machine-identity p { margin: 6px 0 10px; color: #bfc1c7; }
.machine-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: #92959d; font-size: 12px; }
.machine-meta strong { color: #fff; font-weight: 700; }
.machine-token { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.machine-token .link-button { margin-left: 4px; color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.machine-token .link-button:hover { color: #ffb6b6; }
.machine-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 24px; }
.machine-stats article { padding: 15px 17px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.06); }
.machine-stats span, .machine-stats strong { display: block; }
.machine-stats span { color: #aeb0b6; font-size: 11px; font-weight: 700; }
.machine-stats strong { margin-top: 7px; font-size: 22px; font-weight: 800; }
.table-tabs { display: flex; gap: 9px; padding: 17px 20px; overflow-x: auto; scrollbar-width: thin; }
.table-tabs a { display: flex; align-items: center; gap: 10px; min-width: max-content; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.table-tabs a:hover { border-color: #d1d3d8; color: var(--ink); }
.table-tabs a.active { border-color: var(--brand-red); background: var(--brand-red); color: #fff; box-shadow: 0 7px 18px rgba(255,0,0,.16); }
.table-tabs strong { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #f0f1f3; color: var(--ink); font-size: 11px; }
.table-tabs a.active strong { background: rgba(255,255,255,.2); color: #fff; }
.record-search { display: flex; align-items: end; gap: 11px; padding: 18px 22px; border-bottom: 1px solid var(--line); background: #fafafb; }
.record-search label { flex: 1; }
.records-list { display: grid; gap: 10px; padding: 16px; background: #f7f7f8; }
.record-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.record-card[open] { border-color: #d5d7dc; box-shadow: var(--shadow-sm); }
.record-card summary { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(120px, auto) auto; align-items: center; gap: 15px; padding: 15px 17px; cursor: pointer; list-style: none; }
.record-card summary::-webkit-details-marker { display: none; }
.record-summary-main strong, .record-summary-main small { display: block; }
.record-summary-main strong { overflow-wrap: anywhere; font-size: 14px; }
.record-summary-main small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.record-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.record-open { color: var(--brand-red); font-size: 12px; font-weight: 800; white-space: nowrap; }
.record-card[open] .record-open { font-size: 0; }
.record-card[open] .record-open::after { content: "Fechar"; font-size: 12px; }
.record-content { padding: 18px; border-top: 1px solid var(--line); background: #fcfcfd; }
.record-system-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 16px; color: var(--muted); font-size: 11px; }
.record-system-meta strong { margin-left: 4px; color: var(--ink); }
.payload-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.payload-grid > div { min-width: 0; padding: 12px 13px; background: #fff; }
.payload-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.payload-grid dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.compact-panel { margin-bottom: 0; }
.compact-panel .panel-heading a { color: var(--brand-red); font-size: 12px; font-weight: 800; text-decoration: none; }
.compact-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-top: 1px solid var(--line); }
.compact-list > div:first-child { border-top: 0; }
.compact-list span strong, .compact-list span small { display: block; }
.compact-list span strong { font-size: 13px; }
.compact-list span small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.compact-list b { font-size: 12px; white-space: nowrap; }
.machine-link { color: var(--ink); text-decoration: none; }
.machine-link:hover { color: var(--brand-red); text-decoration: underline; }
.pagination { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 17px 20px; border-top: 1px solid var(--line); background: #fafafb; }
.pagination .button { min-width: 112px; }
.pagination .disabled { opacity: .42; cursor: default; pointer-events: none; }
.pagination-summary { text-align: center; }
.pagination-summary strong, .pagination-summary small { display: block; }
.pagination-summary strong { font-size: 13px; }
.pagination-summary small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.pagination-center { display: grid; justify-items: center; gap: 10px; }
.pagination-pages { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; }
.pagination-pages a { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 800; text-decoration: none; transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease; }
.pagination-pages a:hover { border-color: var(--brand-red); color: var(--brand-red); transform: translateY(-1px); }
.pagination-pages a.active { border-color: var(--brand-red); background: var(--brand-red); color: #fff; box-shadow: 0 6px 15px rgba(255,0,0,.16); }
.pagination-pages i { padding: 0 3px; color: var(--muted); font-style: normal; }

.stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.stat-strip article { min-width: 0; padding: 19px 21px; border-left: 1px solid var(--line); }
.stat-strip article:first-child { border-left: 0; }
.stat-strip span, .stat-strip strong, .stat-strip small { display: block; }
.stat-strip span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.stat-strip strong { margin: 8px 0 5px; overflow-wrap: anywhere; font-size: 24px; font-weight: 800; letter-spacing: -.025em; }
.stat-strip small { min-height: 16px; color: var(--muted); font-size: 11px; }
.stat-strip .trend-up { color: var(--success); }
.stat-strip .trend-down { color: var(--danger); }

.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.analytics-grid > .panel { min-width: 0; }
.chart-panel { overflow: hidden; }
.chart-body { position: relative; height: 245px; padding: 18px 22px 8px; background: linear-gradient(180deg, #fff, #fcfcfd); }
.trend-chart { display: block; width: 100%; height: 100%; }
.trend-chart-wide { min-height: 260px; }
.chart-panel-wide .chart-body { height: 295px; }
.chart-legend { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 22px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.chart-legend span { display: flex; align-items: center; gap: 8px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; }
.legend-red { background: var(--brand-red); box-shadow: 0 0 0 4px rgba(255,0,0,.1); }
.legend-dark { background: var(--brand-black); box-shadow: 0 0 0 4px rgba(19,20,23,.1); }
.chart-legend strong { color: var(--ink); font-weight: 800; }

.ranking-list { display: grid; padding: 10px 20px 17px; }
.ranking-item { display: grid; grid-template-columns: 27px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 0; }
.ranking-position { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; background: var(--brand-red-soft); color: var(--brand-red); font-size: 11px; font-weight: 900; }
.ranking-item > div { min-width: 0; }
.ranking-item > div > span { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.ranking-item strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-item b { color: var(--muted); font-size: 12px; }
.progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 999px; background: #eceef1; }
.progress::-webkit-meter-bar { height: 5px; border: 0; border-radius: 999px; background: #eceef1; }
.progress::-webkit-meter-optimum-value { border-radius: 999px; background: linear-gradient(90deg, var(--brand-red), #ff5c5c); }
.progress::-moz-meter-bar { border-radius: 999px; background: linear-gradient(90deg, var(--brand-red), #ff5c5c); }
.progress-dark::-webkit-meter-optimum-value { background: linear-gradient(90deg, var(--brand-black), #555861); }
.progress-dark::-moz-meter-bar { background: linear-gradient(90deg, var(--brand-black), #555861); }
.machine-analytics { margin-bottom: 22px; }
.inventory-help { margin: 0; padding: 14px 25px; border-bottom: 1px solid var(--line); background: #fff9e9; color: #67562c; font-size: 12px; line-height: 1.55; }
.inventory-table { min-width: 1040px; }
.inventory-all-table { min-width: 1380px; }
.inventory-table td { white-space: nowrap; }
.inventory-table td:first-child, .inventory-all-table td:nth-child(2), .inventory-all-table td:nth-child(3) { white-space: normal; }
.inventory-level { display: grid; grid-template-columns: 90px auto; align-items: center; gap: 9px; }
.inventory-level meter { display: block; width: 90px; height: 7px; border: 0; border-radius: 999px; background: #e5e7ea; }
.inventory-level meter::-webkit-meter-bar { height: 7px; border: 0; border-radius: 999px; background: #e5e7ea; }
.inventory-level meter::-webkit-meter-optimum-value { border-radius: 999px; background: linear-gradient(90deg, var(--brand-red), #ff5c5c); }
.inventory-level meter::-moz-meter-bar { border-radius: 999px; background: linear-gradient(90deg, var(--brand-red), #ff5c5c); }
.inventory-level span { color: var(--muted); font-size: 11px; font-weight: 800; }
.inventory-row-attention td { background: #fffdf8; }
.inventory-row-attention:hover td { background: #fff8e9; }
.order-analytics .chart-panel { grid-column: 1 / -1; }

@media (max-width: 1120px) {
    .report-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-filters .button { width: 100%; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .wide { grid-column: span 2; }
    .client-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inline-management-form { grid-template-columns: 1fr 1fr; }
    .machine-location-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .machine-location-form .location-address-field { grid-column: span 2; }
    .client-overview { grid-template-columns: 1fr; }
    .payload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-strip article:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
    .stat-strip article:nth-child(4) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
    .app-shell { padding: 0; }
    .sidebar { position: static; width: auto; min-height: auto; padding: 17px 18px; overflow: visible; }
    .sidebar::after { display: none; }
    .brand { padding: 0 2px 15px; }
    .brand small { display: none; }
    .sidebar nav { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .sidebar nav a { justify-content: center; min-width: 0; padding: 9px 7px; font-size: 12px; }
    .nav-icon { display: none; }
    .sidebar nav a.active { box-shadow: inset 0 -3px 0 var(--brand-red); }
    .logout-form { margin-top: 14px; padding: 13px 3px 0; }
    .content { padding: 29px 17px 50px; }
    .page-header { align-items: flex-end; }
    .machine-stats { grid-template-columns: repeat(2, 1fr); }
    .activity-grid { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
    .client-management-grid { grid-template-columns: 1fr; }
    .order-analytics .chart-panel { grid-column: auto; }
}
@media (max-width: 620px) {
    .report-header-card .panel-heading { align-items: stretch; flex-direction: column; }
    .report-export-actions, .report-export-actions .button { width: 100%; }
    .report-filters { grid-template-columns: 1fr; padding: 17px; }
    .login-card { padding: 32px 24px; border-radius: 20px; }
    h1 { font-size: 35px; }
    .page-header { align-items: flex-start; flex-direction: column; gap: 16px; }
    .page-header-actions, .period-filter-wide, .period-filter-wide label, .period-filter-wide .button { width: 100%; }
    .metrics { grid-template-columns: 1fr; }
    .metrics article { min-height: 142px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .client-form, .inline-management-form, .machine-location-form { grid-template-columns: 1fr; padding: 20px; }
    .machine-location-form .location-address-field { grid-column: auto; }
    .client-form-wide, .client-form-actions { grid-column: auto; }
    .client-form-actions .button, .inline-management-form .button { width: 100%; }
    .client-edit-details > summary { padding: 18px 20px; }
    .client-overview { padding: 21px; }
    .client-overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field-pair { grid-template-columns: 1fr; }
    .management-list > div:not(.empty), .client-user-actions, .client-password-form { align-items: stretch; flex-direction: column; }
    .client-user-actions, .client-user-actions form, .client-password-form input, .client-user-actions .button { width: 100%; }
    .client-user-edit, .client-user-edit-form { width: 100%; }
    .client-user-edit-form { position: static; margin-top: 8px !important; box-shadow: none; }
    .filters { align-items: stretch; flex-direction: column; }
    .filters label { min-width: 0; }
    .filters .button { width: 100%; }
    .token-row { align-items: stretch; flex-direction: column; }
    .sidebar nav { grid-template-columns: repeat(2, 1fr); }
    .panel-heading { align-items: flex-start; padding: 20px; }
    .form-grid { padding: 20px; }
    th, td { padding-right: 14px; padding-left: 14px; }
    .machine-overview { padding: 20px; }
    .machine-identity { align-items: flex-start; }
    .machine-avatar { flex-basis: 52px; width: 52px; height: 52px; border-radius: 14px; }
    .machine-title-row { align-items: flex-start; flex-direction: column; gap: 7px; }
    .machine-title-row h2 { font-size: 24px; }
    .machine-meta { flex-direction: column; gap: 6px; }
    .machine-stats { grid-template-columns: 1fr 1fr; }
    .record-search { align-items: stretch; flex-direction: column; }
    .record-card summary { grid-template-columns: 1fr auto; gap: 10px; }
    .record-date { grid-column: 1; }
    .record-open { grid-column: 2; grid-row: 2; }
    .payload-grid { grid-template-columns: 1fr; }
    .pagination { grid-template-columns: 1fr 1fr; }
    .pagination-center { grid-column: 1 / -1; grid-row: 1; }
    .pagination .button { width: 100%; min-width: 0; }
    .stat-strip { grid-template-columns: 1fr; }
    .stat-strip article { border-top: 1px solid var(--line); border-left: 0; }
    .stat-strip article:first-child { border-top: 0; }
    .chart-body { height: 220px; padding-right: 12px; padding-left: 12px; }
    .chart-legend { align-items: flex-start; flex-direction: column; }
}

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