@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary: #1146d8;
    --primary-strong: #0b2f96;
    --primary-soft: rgba(17, 70, 216, 0.10);
    --accent: #00a67e;
    --accent-soft: rgba(0, 166, 126, 0.14);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.12);
    --danger: #d92d20;
    --danger-soft: rgba(217, 45, 32, 0.12);
    --ink: #142033;
    --ink-soft: #43516a;
    --muted: #6d7b92;
    --line: #d8dfec;
    --line-strong: #c6d0e1;
    --surface: #ffffff;
    --surface-soft: #f6f8fc;
    --surface-strong: #eef3fb;
    --page-top: #edf3fb;
    --page-bottom: #f7f3ea;
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 44px rgba(15, 23, 42, 0.10);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --transition: 0.18s ease;
    --font-heading: "Space Grotesk", sans-serif;
    --font-body: "IBM Plex Sans", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 13px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(17, 70, 216, 0.10), transparent 28rem),
        radial-gradient(circle at top right, rgba(0, 166, 126, 0.08), transparent 24rem),
        linear-gradient(180deg, var(--page-top), var(--page-bottom));
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

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

.container {
    width: min(1460px, calc(100vw - 20px));
    margin: 0 auto;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    background: linear-gradient(135deg, rgba(10, 22, 61, 0.92), rgba(17, 70, 216, 0.88));
    color: #fff;
    box-shadow: 0 10px 28px rgba(11, 24, 54, 0.22);
}

header::before {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #9cd6ff, #b7ffec, #ffe7a1);
}

header .container,
header > .container {
    padding: 12px 0;
}

header h1 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.05rem, 1rem + 0.8vw, 1.45rem);
    letter-spacing: -0.03em;
}

.nav-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
}

.nav-btn,
.btn,
button,
.btn-blue-pill {
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    padding: 8px 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}

.nav-btn {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.nav-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.16);
}

.nav-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-kicker {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
}

.nav-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.76rem;
    font-weight: 700;
}

.nav-btn.nav-btn-danger {
    background: rgba(217, 45, 32, 0.18);
    border-color: rgba(255, 255, 255, 0.1);
}

.nav-btn.nav-btn-secondary {
    background: rgba(255, 255, 255, 0.12);
}

.btn,
button {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(17, 70, 216, 0.20);
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(17, 70, 216, 0.24);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    border-color: var(--line);
    box-shadow: none;
}

.btn-secondary:hover {
    background: #fff;
}

.btn-success {
    background: linear-gradient(135deg, #0d9c72, #0a7a62);
    box-shadow: 0 10px 22px rgba(0, 166, 126, 0.18);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(217, 45, 32, 0.18);
    box-shadow: none;
}

.btn-danger:hover {
    background: rgba(217, 45, 32, 0.18);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: var(--line);
    box-shadow: none;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.72);
}

.btn-blue-pill {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(17, 70, 216, 0.18);
}

.page-shell {
    padding: 18px 0 28px;
}

.hero-panel,
.surface,
.card,
.section-card,
.login-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 22px;
    margin-bottom: 14px;
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: auto -4rem -4rem auto;
    width: 18rem;
    height: 18rem;
    background: radial-gradient(circle, rgba(17, 70, 216, 0.15), transparent 70%);
    pointer-events: none;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-strong);
    color: var(--primary-strong);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
    gap: 14px;
    align-items: end;
}

.hero-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(1.45rem, 1.05rem + 1.25vw, 2.35rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.hero-subtitle {
    margin: 8px 0 0;
    max-width: 62ch;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hero-stats,
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.stat-card,
.mini-stat {
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 252, 0.92));
    border: 1px solid var(--line);
}

.stat-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.stat-note {
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: 0.74rem;
}

.toolbar,
.control-bar,
.section-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 10px;
}

.toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-input,
input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    padding: 8px 11px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-input:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: rgba(17, 70, 216, 0.44);
    box-shadow: 0 0 0 4px rgba(17, 70, 216, 0.10);
    background: #fff;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.surface {
    padding: 16px;
}

.card {
    padding: 16px;
    border-left: 0;
    overflow: hidden;
   
}

.card:hover,
.section-card:hover {
    box-shadow: var(--shadow-md);

}

.card.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card.card-link:hover {
    transform: translateY(-2px);
}

.section-card {
    padding: 160px;
    margin-bottom: 14px;
    
}

.section-title,
.sec-title,
.sec-lbl {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 10px;
    color: var(--ink);
    font-family: var(--font-heading);
    font-size: 0.92rem;
    letter-spacing: -0.02em;
}

.section-title::after,
.sec-title .sec-line,
.sec-lbl .sec-lbl-line,
.section-line {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--line-strong), transparent);
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    background: var(--surface-strong);
    color: var(--primary-strong);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.fleet-grid,
.client-grid,
.tile-grid,
.dashboard-grid,
.grid-2col {
    display: grid;
    gap: 12px;
}

.fleet-grid,
.client-grid,
.tile-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
    align-items: start;
}

.grid-2col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-card,
.p-card,
.sub-card,
.branch-tile {
    position: relative;
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 15px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.98));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.portfolio-card:hover,
.p-card:hover,
.sub-card:hover,
.branch-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(17, 70, 216, 0.22);
}

.portfolio-card::before,
.p-card::before,
.sub-card::before,
.branch-tile::before {
    content: "";
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.monthly::before,
.badge-monthly {
    background: linear-gradient(180deg, #7c3aed, #4f46e5);
}

.p-name,
.tile-title {
    margin: 0 0 8px;
    padding-right: 24px;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.fleet-home .hero-panel {
    padding: 16px 18px;
}

.fleet-home .hero-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.85fr);
    gap: 12px;
}

.fleet-home .hero-subtitle {
    max-width: 48ch;
}

.fleet-home .hero-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-create-form {
    max-width: 560px;
}

.fleet-home .compact-create-form {
    align-items: center;
    margin-top: 12px;
}

.fleet-home .compact-create-form .search-input,
.fleet-home .compact-create-form input[type="text"] {
    min-height: 40px;
}

.fleet-home .stat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 84px;
    justify-content: center;
}

.fleet-home .stat-note {
    display: none;
}

.portfolio-home .hero-panel {
    padding: 16px 18px;
}

.portfolio-home .hero-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.72fr);
    gap: 12px;
}

.portfolio-home .hero-subtitle {
    max-width: 52ch;
}

.portfolio-home .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portfolio-home .stat-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 84px;
    justify-content: center;
}

.portfolio-home .dashboard-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(220px, 0.58fr);
    gap: 10px;
}

.portfolio-home .sidebar-stack {
    gap: 10px;
}

.portfolio-home .stack-card {
    padding: 14px;
    border-radius: 16px;
}

.portfolio-home .stack-card h3 {
    margin-bottom: 10px;
}

.portfolio-home .stack-card p {
    margin: 8px 0 0;
}

.portfolio-home .pc-card .card {
    padding: 14px 16px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.portfolio-home .pc-card {
    margin-bottom: 12px;
}

.portfolio-home .pc-card:hover .card {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(17, 70, 216, 0.22);
}

.history-page .history-report-card {
    margin-bottom: 12px;
}

.history-page .container {
    width: min(900px, calc(100vw - 20px));
}

.history-page .hero-panel {
    padding: 14px 16px;
    margin-bottom: 10px;
}

.history-page .hero-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(210px, 0.72fr);
    gap: 10px;
}

.history-page .hero-title {
    font-size: clamp(1.3rem, 1rem + 0.9vw, 2rem);
}

.history-page .hero-subtitle {
    max-width: 44ch;
    font-size: 0.78rem;
}

.history-page .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.history-page .stat-card {
    min-height: 72px;
    padding: 10px 12px;
}

.history-page .history-report-card {
    padding: 12px 14px;
    border-radius: 18px;
}

.history-page .history-report-card .card-top {
    gap: 8px;
    padding-bottom: 10px;
}

.history-page .history-report-card .card-divider {
    margin-bottom: 10px;
}

.history-page .history-report-card .card-body {
    gap: 10px;
}

.history-page .history-report-card .data-row {
    gap: 6px;
}

.history-page .history-report-card .audit-date {
    font-size: 0.84rem;
}

.history-page .history-report-card .time-pills {
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.print-only {
    display: none;
}

.machine-shell {
    display: grid;
    gap: 10px;
}

.machine-topline {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.9fr);
    gap: 12px;
    align-items: start;
}

.machine-title-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.machine-name {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.18rem;
    letter-spacing: -0.03em;
}

.machine-device-name {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: var(--radius-pill);
    background: var(--surface-strong);
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 700;
}

.machine-top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}

.machine-assign-form {
    flex-wrap: nowrap;
}

.machine-assign-form input[type="text"] {
    min-width: 180px;
}

.machine-report-link {
    min-width: 150px;
}

.recommendation-strip {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.machine-meta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.machine-metrics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 170px;
    gap: 14px;
    align-items: start;
}

.machine-metrics-col {
    display: grid;
    gap: 10px;
}

.machine-housekeeping-panel {
    padding-left: 10px;
    border-left: 1px dashed var(--line);
}

.machine-footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.7fr);
    gap: 14px;
    align-items: start;
}

.machine-management-panel {
    display: grid;
    gap: 10px;
    align-content: start;
    justify-items: end;
}

.machine-move-form {
    width: 100%;
}

.machine-move-form select {
    min-width: 210px;
}

.machine-bottom-actions {
    margin-top: 10px;
    justify-content: flex-start;
}

.view-toggle {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.view-toggle .btn {
    min-width: 70px;
}

.view-toggle .btn.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(17, 70, 216, 0.18);
}

.fleet-grid .p-card {
    min-height: 118px;
    padding-right: 42px;
}

.fleet-grid .p-name {
    font-size: 1.02rem;
    margin-bottom: 6px;
}

.fleet-grid.list-view {
    grid-template-columns: 1fr;
}

.fleet-grid.list-view .portfolio-card-wrap {
    width: 100%;
}

.fleet-grid.list-view .p-card {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: auto;
}

.fleet-grid.list-view .p-name,
.fleet-grid.list-view .p-meta {
    margin: 0;
}

.p-meta,
.tile-meta,
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pill,
.badge,
.chip,
.portal-badge,
.tech-tag,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    padding: 5px 8px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.note-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 8px;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 247, 237, 0.95);
    color: #c2410c;
    font-size: 0.92rem;
    line-height: 1;
    vertical-align: middle;
    user-select: none;
}

.note-indicator.small {
    width: 24px;
    height: 24px;
    margin-left: 10px;
    font-size: 0.85rem;
}

.pill-blue,
.badge-blue {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: rgba(17, 70, 216, 0.10);
}

.pill-green,
.chip-ok,
.status-complete {
    background: var(--accent-soft);
    color: #0c755e;
    border-color: rgba(0, 166, 126, 0.10);
}

.pill-yellow,
.chip-warn {
    background: var(--warning-soft);
    color: #8a530a;
    border-color: rgba(217, 119, 6, 0.10);
}

.pill-red,
.chip-danger,
.status-missing {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(217, 45, 32, 0.10);
}

.pill-purple,
.badge-monthly {
    color: #5b21b6;
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.10);
}

.pill-gray,
.badge-tech {
    background: rgba(67, 81, 106, 0.10);
    color: var(--ink-soft);
    border-color: rgba(67, 81, 106, 0.10);
}

.badge-admin {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.p-arrow {
    position: absolute;
    right: 18px;
    top: 18px;
    color: var(--primary);
    opacity: 0.55;
    font-weight: 700;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 12px;
}

.audit-date {
    display: inline-block;
    margin-right: 8px;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.tech-tag {
    background: var(--surface-strong);
    color: var(--ink-soft);
}

.card-divider,
hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 0 0 12px;
}

.card-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.pc-card .card {
    overflow: visible;
}

.recommendation-cluster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 6px;
}

.recommendation-bubble {
    display: grid;
    gap: 4px;
    align-content: start;
    min-height: auto;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.recommendation-bubble span {
    white-space: normal;
}

.recommendation-bubble.rec-danger {
    background: var(--danger-soft);
    color: #9f1239;
    border-color: rgba(217, 45, 32, 0.18);
}

.recommendation-bubble.rec-warning {
    background: var(--warning-soft);
    color: #9a3412;
    border-color: rgba(217, 119, 6, 0.18);
}

.recommendation-bubble.rec-primary {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: rgba(17, 70, 216, 0.16);
    
}

.recommendation-tooltip {
    position: static;
    width: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transition: none;
    z-index: auto;
    transform: none;
}

.recommendation-tooltip strong,
.recommendation-tooltip span {
    display: block;
    white-space: normal;
}

.recommendation-tooltip strong {
    margin-bottom: 0;
    font-size: 0.76rem;
}

.recommendation-tooltip span {
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--ink-soft);
}

.data-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.data-label,
.m-label,
.status-label,
.hk-title {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.data-value,
.m-value {
    color: var(--ink);
    font-weight: 600;
}

.history-glance {
    margin-top: 16px;
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}

.history-row {
    display: grid;
    grid-template-columns: 110px 1fr 110px 70px;
    gap: 12px;
    align-items: center;
    padding: 7px 0;
    color: var(--ink-soft);
    font-size: 0.78rem;
}

.portfolio-home .machine-history-panel .history-row {
    grid-template-columns: 96px 110px 110px 1fr 70px;
}

.hk-container {
    text-align: center;
}

.hk-labels {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hk-labels span,
.tick {
    width: 36px;
    text-align: center;
}

.hk-ticks {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 6px;
}

.tick {
    font-size: 1rem;
}

.status-meta {
    text-align: right;
}

.time-pills {
    margin-bottom: 10px;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
}

.hds-pill {
    color: #0d8b6a;
}

.ps-pill {
    color: var(--primary);
}

.empty-state {
    padding: 56px 28px;
    text-align: center;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--line-strong);
    background: rgba(255, 255, 255, 0.76);
    color: var(--ink-soft);
}

.sidebar-stack {
    display: grid;
    gap: 16px;
}

.stack-card {
    padding: 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-sm);
}

.stack-card h3,
.section-card h3 {
    margin: 0 0 14px;
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.stack-card p,
.section-card p {
    color: var(--ink-soft);
}

.form-stack,
.create-form {
    display: grid;
    gap: 10px;
}

.label {
    display: block;
    color: var(--ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

.tech-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.tech-row:last-child {
    border-bottom: none;
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.tab {
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    box-shadow: none;
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
    border-color: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.data-table,
.nested-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.90);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td,
.nested-table th,
.nested-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.data-table th,
.nested-table th {
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table tr:last-child th,
.data-table tr:last-child td,
.nested-table tr:last-child th,
.nested-table tr:last-child td {
    border-bottom: none;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.metric-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(248, 250, 255, 0.98);
    border: 1px solid var(--line);
}

.health-green {
    color: #0d8b6a;
    font-weight: 700;
}

.health-yellow {
    color: #a16207;
    font-weight: 700;
}

.health-orange {
    color: #c2410c;
    font-weight: 700;
}

.health-red {
    color: var(--danger);
    font-weight: 700;
}

.health-unknown {
    color: var(--muted);
}

.ram-green {
    color: #0d8b6a;
}

.ram-yellow {
    color: #a16207;
}

.ram-orange {
    color: #c2410c;
}

.ram-red {
    color: var(--danger);
    font-weight: 700;
}

.drop-stamp,
.drop-note {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-style: italic;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.8rem;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.bc-sep {
    color: rgba(255, 255, 255, 0.42);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
    background:
        linear-gradient(135deg, rgba(8, 16, 46, 0.62), rgba(9, 34, 82, 0.44)),
        url('/static/assets/img/bg.jpg') center / cover no-repeat;
}

.login-wrapper {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 430px);
    gap: 18px;
    align-items: stretch;
}

.brand-panel {
    padding: 34px;
    border-radius: 28px;
    color: #fff;
    background: linear-gradient(145deg, rgba(10, 23, 66, 0.78), rgba(15, 58, 140, 0.58));
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    box-shadow: 0 22px 48px rgba(4, 15, 42, 0.24);
}

.brand-panel h1 {
    margin: 14px 0 10px;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 1.5rem + 1.2vw, 3.2rem);
    line-height: 0.96;
    letter-spacing: -0.06em;
}

.brand-panel p {
    margin: 0;
    max-width: 42ch;
    color: rgba(255, 255, 255, 0.82);
}

.brand-list {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.brand-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.brand-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.login-card {
    padding: 28px;
    backdrop-filter: blur(10px);
}

.tab-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 20px;
    padding: 6px;
    border-radius: 18px;
    background: var(--surface-soft);
}

.tab-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.tab-btn.active,
.tab-btn.client-active {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.role-badge {
    margin-bottom: 10px;
}

.login-panel {
    display: none;
}

.login-panel.active {
    display: block;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.subtitle,
.footer-note {
    color: var(--muted);
    font-size: 0.85rem;
}

.error-msg {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--danger-soft);
    border: 1px solid rgba(217, 45, 32, 0.16);
    color: var(--danger);
    font-weight: 700;
}

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

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #c7d3e5;
    border-radius: 999px;
}

@media (max-width: 980px) {
    .dashboard-grid,
    .hero-grid,
    .login-wrapper,
    .grid-2col {
        grid-template-columns: 1fr;
    }

    .status-meta {
        text-align: left;
    }

    .machine-topline,
    .machine-top-actions,
    .machine-metrics-grid,
    .machine-footer-grid {
        grid-template-columns: 1fr;
    }

    .machine-housekeeping-panel {
        padding-left: 0;
        border-left: 0;
        border-top: 1px dashed var(--line);
        padding-top: 10px;
    }

    .machine-management-panel {
        justify-items: stretch;
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding-top: 20px;
    }

    .container {
        width: min(100vw - 24px, 1240px);
    }

    .hero-panel,
    .card,
    .section-card,
    .stack-card,
    .login-card,
    .brand-panel {
        padding: 20px;
        border-radius: 20px;
    }

    .card-top,
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-bar {
        justify-content: flex-start;
    }

    .card-body {
        grid-template-columns: 1fr;
    }

    .machine-assign-form {
        flex-wrap: wrap;
    }

    .machine-move-form select {
        min-width: 0;
    }

    .history-row {
        grid-template-columns: 1fr 1fr;
    }

    .metrics-grid,
    .hero-stats,
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .metrics-grid,
    .hero-stats,
    .stat-grid,
    .fleet-grid,
    .client-grid,
    .tile-grid {
        grid-template-columns: 1fr;
    }

    .history-row {
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff !important;
        color: #0f172a !important;
        font-size: 11pt;
    }

    header,
    .nav-bar,
    .sidebar-stack,
    .hero-actions,
    .hero-panel,
    .toolbar,
    .section-toolbar,
    .view-toggle,
    .inline-actions,
    button,
    .btn,
    .btn-blue-pill,
    .nav-btn,
    form {
        display: none !important;
    }

    .container {
        width: 100% !important;
        max-width: none !important;
    }

    .page-shell {
        padding: 0 !important;
    }

    .print-only {
        display: block !important;
    }

    .print-report-header {
        margin: 0 0 12px;
        padding: 0 0 10px;
        border-bottom: 2px solid #cbd5e1;
    }

    .print-kicker {
        font-size: 9pt;
        font-weight: 800;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #475569;
    }

    .print-title {
        margin: 4px 0 0;
        font-family: var(--font-heading);
        font-size: 20pt;
        line-height: 1.05;
        color: #0f172a;
    }

    .print-subtitle {
        margin: 6px 0 0;
        color: #475569;
        font-size: 10pt;
    }

    .hero-panel,
    .surface,
    .card,
    .section-card,
    .stack-card,
    .history-report-card {
        box-shadow: none !important;
        border: 1px solid #d8dfec !important;
        break-inside: avoid;
        page-break-inside: avoid;
        background: #fff !important;
    }

    .dashboard-grid,
    .hero-grid,
    .machine-topline,
    .machine-top-actions,
    .machine-metrics-grid,
    .machine-footer-grid {
        grid-template-columns: 1fr !important;
    }

    .pc-card,
    .history-report-card {
        margin-bottom: 10px !important;
    }

    .recommendation-cluster,
    .history-glance,
    .metrics-grid,
    .stat-grid,
    .hero-stats {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .machine-housekeeping-panel {
        border-left: 0 !important;
        padding-left: 0 !important;
        border-top: 1px dashed #d8dfec;
        padding-top: 8px;
    }

    .portal-home-page .hero-panel,
    .portfolio-home .hero-panel,
    .history-page .hero-panel {
        margin-bottom: 10px;
    }

    .history-page .print-report-header {
        margin-bottom: 8px;
        padding-bottom: 8px;
    }

    .history-page .container {
        width: 900px !important;
        max-width: 900px !important;
        margin: 0 auto !important;
    }

    .history-page .history-report-card {
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }

    .history-page .history-report-card .card-top {
        display: grid;
        grid-template-columns: 160px 1fr 160px;
        gap: 10px;
        padding-bottom: 8px;
        align-items: start;
    }

    .history-page .history-report-card .card-divider {
        margin-bottom: 8px;
    }

    .history-page .history-report-card .card-body {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px;
    }

    .history-page .history-report-card .data-row {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 8px;
        align-items: baseline;
    }

    .history-page .history-report-card .data-label {
        font-size: 7.8pt;
    }

    .history-page .history-report-card .data-value,
    .history-page .history-report-card .drop-note {
        font-size: 9.6pt;
    }

    .history-page .history-report-card .hk-container,
    .history-page .history-report-card .status-meta {
        text-align: right;
    }

    .history-page .history-report-card .hk-labels,
    .history-page .history-report-card .hk-ticks {
        justify-content: flex-end;
        gap: 6px;
        margin-top: 4px;
    }

    .history-page .history-report-card .hk-labels span,
    .history-page .history-report-card .tick {
        width: 28px;
        font-size: 7.8pt;
    }

    .history-page .history-report-card .time-pills {
        margin-bottom: 0;
        font-size: 8pt;
    }

    .history-page .history-report-card .audit-date {
        font-size: 10pt;
    }

    .portfolio-home .container {
        width: 900px !important;
        max-width: 900px !important;
        margin: 0 auto !important;
    }

    .portfolio-home .print-report-header {
        margin-bottom: 2px;
        padding-bottom: 3px;
    }

    .portfolio-home .print-title {
        font-size: 17pt;
        margin-top: 1px;
    }

    .portfolio-home .print-subtitle {
        display: none !important;
    }

    .portfolio-home .dashboard-grid,
    .portfolio-home .dashboard-grid > section {
        display: block !important;
    }

    .portfolio-home .sec-title {
        margin: 0 0 6px !important;
    }

    .portfolio-home #computers-section {
        margin-top: 0 !important;
    }

    .portfolio-home .sub-row,
    .portfolio-home .tile-grid {
        display: none !important;
    }

    .portfolio-home .pc-card .card {
        padding: 8px 10px !important;
        border-radius: 8px !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .portfolio-home .pc-card {
        margin-bottom: 8px !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .portfolio-home .print-page-break-before {
        break-before: page !important;
        page-break-before: always !important;
    }

    .portfolio-home .machine-shell {
        gap: 6px;
    }

    .portfolio-home .machine-topline {
        grid-template-columns: 1.2fr 0.8fr !important;
        gap: 8px;
        align-items: start;
    }

    .portfolio-home .machine-top-actions {
        grid-template-columns: 1fr auto !important;
        gap: 8px;
    }

    .portfolio-home .machine-name {
        font-size: 12pt;
    }

    .portfolio-home .machine-device-name {
        font-size: 7.6pt;
    }

    .portfolio-home .recommendation-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px;
    }

    .portfolio-home .recommendation-bubble {
        padding: 5px 6px;
        border-radius: 7px;
    }

    .portfolio-home .recommendation-bubble > span {
        font-size: 7.5pt;
    }

    .portfolio-home .recommendation-tooltip span {
        font-size: 7.8pt;
        line-height: 1.2;
    }

    .portfolio-home .machine-meta-row {
        gap: 4px;
    }

    .portfolio-home .machine-metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px;
    }

    .portfolio-home .machine-metrics-col {
        gap: 6px;
    }

    .portfolio-home .machine-housekeeping-panel {
        border-left: 1px dashed #d8dfec !important;
        border-top: 0 !important;
        padding-left: 8px !important;
        padding-top: 0 !important;
    }

    .portfolio-home .data-row {
        display: grid;
        grid-template-columns: 80px minmax(0, 1fr);
        gap: 6px;
        align-items: baseline;
    }

    .portfolio-home .data-label {
        font-size: 7.4pt;
    }

    .portfolio-home .data-value,
    .portfolio-home .drop-stamp,
    .portfolio-home .drop-note {
        font-size: 8.7pt;
    }

    .portfolio-home .hk-labels,
    .portfolio-home .hk-ticks {
        gap: 5px;
        margin-top: 3px;
    }

    .portfolio-home .hk-labels span,
    .portfolio-home .tick {
        width: 24px;
        font-size: 7.1pt;
    }

    .portfolio-home .time-pills {
        margin-bottom: 0;
        font-size: 7.5pt;
    }

    .portfolio-home .machine-footer-grid {
        grid-template-columns: 1.2fr 0.8fr !important;
        gap: 8px;
    }

    .portfolio-home .history-glance {
        display: none !important;
    }

    .portfolio-home .history-glance {
        margin-top: 0;
        padding-top: 8px;
    }

    .portfolio-home .history-row {
        grid-template-columns: 96px 1fr 90px 60px;
        gap: 8px;
        font-size: 8.2pt;
    }

    .portfolio-home .machine-bottom-actions {
        margin-top: 8px;
    }

    .section-tag,
    .pill,
    .tech-tag,
    .status-pill,
    .portal-badge,
    .nav-user-chip,
    .machine-device-name {
        border: 1px solid #cbd5e1 !important;
        background: #f8fafc !important;
        color: #334155 !important;
    }

    .recommendation-bubble {
        background: #fff !important;
        border-width: 1px !important;
    }

    .recommendation-bubble.rec-danger {
        border-color: #fca5a5 !important;
    }

    .recommendation-bubble.rec-warning {
        border-color: #fdba74 !important;
    }

    .recommendation-bubble.rec-primary {
        border-color: #93c5fd !important;
    }

    .data-row,
    .history-row {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .history-glance {
        margin-top: 8px;
        padding-top: 8px;
    }

    @page {
        size: A4;
        margin: 12mm;
    }
}
