:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --sidebar: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e8edf3;
    --accent: #2563eb;
    --accent-soft: #eff6ff;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius: 16px;
    --sidebar-width: 285px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

svg {
    fill: currentColor;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.35rem 0.5rem 1.25rem;
}

.sidebar-brand > div:last-child {
    min-width: 0;
    flex: 1;
}

.brand-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-brand strong {
    display: block;
    font-size: 0.88rem;
    line-height: 1.25;
}

.sidebar-brand span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.3;
    margin-top: 0.15rem;
}

.sidebar-nav {
    display: grid;
    gap: 0.2rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.72rem 0.85rem;
    border-radius: 12px;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.94rem;
}

.sidebar-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.sidebar-quick {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.sidebar-quick h3 {
    margin: 0 0 0.75rem;
    padding: 0 0.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.5rem;
    color: #4b5563;
    font-size: 0.9rem;
}

.quick-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.quick-dot-blue { background: #3b82f6; }
.quick-dot-green { background: #22c55e; }
.quick-dot-purple { background: #a855f7; }
.quick-dot-orange { background: #f97316; }

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.5rem 0.25rem;
    border-top: 1px solid var(--border);
}

.sidebar-footer-link {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    text-decoration: none;
}

.sidebar-footer-link:hover,
.sidebar-footer-link.active {
    color: var(--accent);
}

.main-shell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-search {
    flex: 1;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.9rem;
}

.topbar-search svg {
    width: 18px;
    height: 18px;
    color: var(--muted);
    flex-shrink: 0;
}

.topbar-search input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 0;
    font: inherit;
    outline: none;
}

.topbar-search kbd {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.lang-link {
    color: var(--muted);
}

.lang-link.active {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.language-divider {
    color: #d1d5db;
}

.icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: #4b5563;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.icon-button svg {
    width: 18px;
    height: 18px;
}

.notification-panel {
    position: relative;
}

.notification-panel summary {
    list-style: none;
}

.notification-panel summary::-webkit-details-marker {
    display: none;
}

.notification-trigger {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 320px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    z-index: 30;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    border-bottom: 1px solid #f1f5f9;
}

.notification-item a,
.notification-item span {
    display: block;
    padding: 0.8rem 1rem;
    color: inherit;
}

.notification-item strong {
    display: block;
    font-size: 0.88rem;
}

.notification-item span {
    color: var(--muted);
    font-size: 0.8rem;
    padding-top: 0;
}

.notification-warning strong { color: #c2410c; }
.notification-danger strong { color: #dc2626; }
.notification-info strong { color: #2563eb; }

.search-sections {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.search-sections article {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
}

.search-sections h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.clean-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clean-list li + li {
    margin-top: 0.45rem;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.82rem;
    font-weight: 700;
}

.page-content {
    padding: 1.25rem 1.5rem 1.5rem;
    display: grid;
    gap: 1.25rem;
}

.dashboard-hero {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 1rem;
}

.dashboard-hero h1 {
    margin: 0;
    font-size: 1.75rem;
}

.dashboard-hero p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.datetime-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    text-align: right;
    box-shadow: var(--shadow);
    min-width: 210px;
}

.datetime-card strong {
    display: block;
    font-size: 0.92rem;
}

.datetime-card span {
    color: var(--muted);
    font-size: 0.88rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
    box-shadow: var(--shadow);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 22px;
    height: 22px;
}

.kpi-blue { background: #eff6ff; color: #2563eb; }
.kpi-orange { background: #fff7ed; color: #ea580c; }
.kpi-purple { background: #f5f3ff; color: #7c3aed; }
.kpi-green { background: #ecfdf5; color: #16a34a; }
.kpi-cyan { background: #ecfeff; color: #0891b2; }
.kpi-red { background: #fef2f2; color: #dc2626; }

.kpi-card strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1.1;
}

.kpi-card span {
    color: var(--muted);
    font-size: 0.82rem;
}

.kpi-card em {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
    font-style: normal;
    margin-top: 0.15rem;
}

.kpi-link {
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.widget-grid {
    display: grid;
    gap: 1rem;
}

.widget-grid-top {
    grid-template-columns: 1.1fr 1fr 1fr;
}

.widget-grid-bottom {
    grid-template-columns: 0.9fr 1.4fr;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.2rem;
    box-shadow: var(--shadow);
}

.card h3 {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 600;
}

.chart-wrap {
    position: relative;
    height: 220px;
    max-height: 220px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.chart-wrap--compact {
    height: 180px;
    max-height: 180px;
}

.chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-height: 220px;
}

.widget-overview,
.widget-site {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    min-height: 190px;
}

.widget-copy h4 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
}

.overview-list {
    margin: 0.85rem 0 0;
}

.overview-list div {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.5rem;
    padding: 0.35rem 0;
}

.overview-list dt {
    color: var(--muted);
    font-size: 0.88rem;
}

.overview-list dd {
    margin: 0;
    font-size: 0.92rem;
}

.meta-row {
    margin-top: 0.35rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-success {
    background: #ecfdf5;
    color: #15803d;
}

.status-info {
    background: #eff6ff;
    color: #1d4ed8;
}
.status-warning {
    background: #fef3c7;
    color: #92400e;
}
.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

.site-standard {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.widget-illustration {
    width: 110px;
    height: 110px;
    border-radius: 18px;
    position: relative;
}

.lab-illustration {
    background: linear-gradient(180deg, #eff6ff, #dbeafe);
}

.building-illustration {
    background: linear-gradient(180deg, #f8fafc, #e2e8f0);
}

.building-illustration::before {
    content: "";
    position: absolute;
    inset: 18px 24px 16px;
    background: linear-gradient(180deg, #94a3b8, #64748b);
    border-radius: 8px 8px 4px 4px;
}

.building-illustration::after {
    content: "";
    position: absolute;
    left: 34px;
    right: 34px;
    bottom: 16px;
    height: 10px;
    background: #cbd5e1;
    border-radius: 2px;
}

.illus-flask,
.illus-scope {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
}

.illus-flask {
    width: 34px;
    height: 34px;
    left: 18px;
    top: 24px;
}

.illus-scope {
    width: 42px;
    height: 42px;
    right: 16px;
    bottom: 18px;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.widget-header h3 {
    margin: 0;
}

.text-link {
    font-size: 0.88rem;
    font-weight: 500;
}

.method-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.method-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.method-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.method-list strong {
    display: block;
    font-size: 0.92rem;
}

.method-list span {
    color: var(--muted);
    font-size: 0.82rem;
}

.method-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #16a34a;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.priority-layout {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.donut-wrap {
    flex-shrink: 0;
}

.donut-chart {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.donut-hole {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-content: center;
    text-align: center;
}

.donut-hole strong {
    font-size: 1.35rem;
    line-height: 1;
}

.donut-hole span {
    color: var(--muted);
    font-size: 0.75rem;
}

.priority-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
    flex: 1;
}

.priority-legend li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.priority-legend strong {
    margin-left: auto;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-high { background: #ef4444; }
.legend-normal { background: #3b82f6; }
.legend-low { background: #cbd5e1; }

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

.audit-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.audit-table th,
.audit-table td {
    text-align: left;
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    vertical-align: middle;
}

.audit-table th {
    color: var(--muted);
    font-weight: 600;
}

.trust-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}

.trust-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    box-shadow: var(--shadow);
}

.trust-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.trust-green { background: #ecfdf5; color: #16a34a; }
.trust-blue { background: #eff6ff; color: #2563eb; }
.trust-purple { background: #f5f3ff; color: #7c3aed; }

.trust-item strong {
    display: block;
    font-size: 0.88rem;
}

.trust-item span {
    color: var(--muted);
    font-size: 0.8rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.button-secondary {
    background: var(--accent-soft);
    color: var(--accent);
}

.button-link,
.text-link {
    color: var(--muted);
}

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

.table-subline {
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1fr 220px auto auto;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: center;
}

.filter-bar-samples {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    margin-bottom: 1rem;
    align-items: end;
}

.filter-bar-samples .filter-bar-search {
    grid-column: 1 / -1;
}

.filter-bar-samples .filter-bar-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filter-bar-samples select,
.filter-bar-samples input[type="date"],
.filter-bar-samples input[type="search"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font: inherit;
    background: #fff;
}

.filter-date {
    display: grid;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
}

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

.table-scroll table {
    min-width: 960px;
}

.badge {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.action-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.detail-list {
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #e4e9f2;
}

.detail-list dt {
    font-weight: 600;
    color: var(--muted);
}

.detail-list dd {
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.25rem 1rem;
}

.qc-form .form-actions {
    margin-top: 0.75rem;
}

.customer-form label {
    font-weight: 600;
    color: var(--muted);
}

.form-actions {
    margin-top: 1rem;
}

.form-errors {
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #f3c0bc;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.pagination {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    text-align: left;
    border-bottom: 1px solid #e4e9f2;
    padding: 0.75rem 0.4rem;
    vertical-align: top;
}

form p {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #c9d3e1;
    border-radius: 10px;
    box-sizing: border-box;
    font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
}

@media (max-width: 1200px) {
    .kpi-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .widget-grid-top,
    .widget-grid-bottom,
    .trust-footer {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-search {
        max-width: none;
    }

    .dashboard-hero {
        flex-direction: column;
    }

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

@media (max-width: 768px) {
    .filter-bar,
    .filter-bar-samples,
    .detail-list div {
        grid-template-columns: 1fr;
    }

    .filter-bar-samples .filter-bar-search,
    .filter-bar-samples .filter-bar-actions {
        grid-column: auto;
    }
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 42%),
        var(--bg);
}

.auth-layout {
    width: min(100%, 440px);
    display: grid;
    gap: 1.25rem;
}

.auth-brand {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.auth-brand-text {
    min-width: 0;
}

.auth-brand-text h1 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
}

.auth-brand-text p {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.auth-card {
    margin: 0;
}

.auth-card-kicker {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.auth-flash {
    margin: 0;
}

.auth-language {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.app-footer {
    margin-top: auto;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

.app-footer p {
    margin: 0;
    line-height: 1.5;
}

.app-footer a {
    color: #4b5563;
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.footer-divider {
    margin: 0 0.35rem;
    color: #cbd5e1;
}

.auth-layout .app-footer {
    margin-top: 0.5rem;
    padding: 1rem 0 0;
    border-top: none;
    text-align: center;
}

.form-card .form-field {
    margin-bottom: 1rem;
}

.form-card .form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.sample-analysis-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.form-field-sample-type select {
    width: 100%;
    max-width: 520px;
}

form p.form-field-checkbox {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

form p.form-field-checkbox label {
    margin: 0;
    font-weight: 500;
}

.form-card input[type="checkbox"] {
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: 0;
}

.button-small {
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
}

.equipment-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.25rem 1rem;
    align-items: end;
}

.equipment-form-grid .form-field-checkbox {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1rem;
    min-height: 2.75rem;
}

.equipment-form-grid .form-field-checkbox label {
    margin: 0;
    font-weight: 500;
    white-space: nowrap;
}

.equipment-form-actions {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.form-card input[type="text"],
.form-card input[type="date"],
.form-card input[type="datetime-local"],
.form-card select,
.form-card textarea {
    width: 100%;
    max-width: 520px;
}

.form-errors,
.field-error {
    color: #b91c1c;
    font-size: 0.88rem;
}

.test-selection-panel {
    margin: 1rem 0 0;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fafbfd;
}

#test-selection-groups {
    display: block;
}

.test-selection-group {
    display: block;
}

.test-selection-header h3 {
    margin: 0 0 0.35rem;
}

.test-selection-group + .test-selection-group {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.test-selection-group h4 {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    color: #1e3a5f;
}

.test-checkbox-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.test-selection-panel .test-checkbox-list label {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    font-weight: 400;
    cursor: pointer;
    max-width: 100%;
}

.test-checkbox-list input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
    width: auto;
    max-width: none;
}

.test-checkbox-label {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.test-selection-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.user-menu { display: flex; align-items: center; gap: 0.75rem; }
.user-meta { display: flex; flex-direction: column; font-size: 0.8rem; }
.user-meta span { color: var(--muted); }
.site-switcher select { border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.5rem; }
.validation-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
.validation-nav { display: flex; flex-direction: column; gap: 0.35rem; }
.validation-nav a { padding: 0.5rem 0.75rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.validation-nav a.active { background: #e8f0fe; color: #1e3a5f; font-weight: 600; }
.label-preview { display: flex; gap: 1.5rem; align-items: center; margin: 1rem 0; }
.label-preview img { width: 140px; height: 140px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1rem 0; }
.button-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.inline-form { display: flex; gap: 0.35rem; align-items: center; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.flash-messages { margin-bottom: 1rem; }
.flash-messages li { list-style: none; padding: 0.5rem 0.75rem; border-radius: 8px; background: #ecfdf5; margin-bottom: 0.35rem; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.calendar-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.45rem; }
.calendar-day-head { font-size: 0.8rem; color: var(--muted); text-align: center; padding: 0.25rem 0; }
.calendar-day { border: 1px solid var(--border); border-radius: 8px; min-height: 72px; padding: 0.4rem; display: grid; align-content: space-between; color: var(--text); background: #fff; }
.calendar-day span { font-weight: 600; }
.calendar-day small { color: var(--muted); font-size: 0.72rem; }
.calendar-day.active { border-color: var(--accent); background: var(--accent-soft); }
.calendar-day.muted-day { opacity: 0.45; }
.task-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.mini-label { border: 1px solid var(--border); border-radius: 8px; padding: 0.65rem; display: flex; gap: 0.75rem; align-items: center; background: #fff; }
.mini-label img { width: 86px; height: 86px; }
.mini-label p { margin: 0.2rem 0; color: var(--muted); font-size: 0.85rem; }

.topbar-search-placeholder {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 0.75rem;
}

.settings-card {
    padding-bottom: 1.5rem;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 1rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    background: #f8fafc;
    border: 1px solid transparent;
}

.settings-tab:hover {
    color: var(--accent);
    border-color: #dbeafe;
}

.settings-tab.active {
    color: var(--accent);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.section-header-inline {
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.analysis-limits-section + .analysis-limits-section {
    margin-top: 2rem;
}

.analysis-limits-section h3 {
    margin: 0 0 0.75rem;
}

.analysis-limits-group {
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
    color: var(--muted);
}

.analysis-limits-table .limit-input {
    width: 100%;
    min-width: 5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    font: inherit;
}

.analysis-limits-table .limit-input-unit {
    min-width: 6.5rem;
}

.analysis-limits-table .limit-standard {
    font-size: 0.82rem;
    color: var(--muted);
    max-width: 14rem;
}

.analysis-limits-table .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
}

.analysis-limits-confirm {
    margin-top: 2rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}

.limit-password {
    display: grid;
    gap: 0.35rem;
    max-width: 320px;
    margin: 0.75rem 0;
}

.limit-password input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font: inherit;
}

.app-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    align-items: end;
}

.app-settings-field label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.app-settings-field input[type="number"],
.app-settings-field select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font: inherit;
    background: #fff;
}

.app-settings-field-checkbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    gap: 0.45rem;
    min-height: 4.5rem;
}

.app-settings-field-checkbox label {
    margin-bottom: 0;
}

.app-settings-field-checkbox input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--accent);
}

.app-settings-actions,
.settings-actions {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.button.settings-save-button {
    padding: 0.7rem 1.4rem;
    font-size: 1rem;
    font-weight: 600;
    min-height: 2.75rem;
    min-width: 9rem;
}

.button.button-secondary.settings-save-button {
    min-width: 9rem;
}

@media (max-width: 900px) {
    .app-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .app-settings-grid {
        grid-template-columns: 1fr;
    }

    .app-settings-field-checkbox {
        min-height: auto;
        align-items: flex-start;
        text-align: left;
    }
}

body.modal-open {
    overflow: hidden;
}

.app-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.45);
}

.app-modal-overlay[hidden] {
    display: none;
}

.app-modal {
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.app-modal-title {
    margin: 0;
    font-size: 1.1rem;
}

.app-modal-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
}

.app-modal-close:hover {
    color: var(--text);
}

.app-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-panel .form-grid,
.modal-panel table {
    margin-top: 0.75rem;
}

.modal-summary {
    margin: 0 0 1rem;
    color: var(--muted);
}

.modal-flash {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    margin: 0 0 0.85rem;
}

.modal-flash-success {
    background: #ecfdf5;
    color: #065f46;
}

.modal-flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.eln-list {
    margin: 1rem 0 0;
    padding-left: 1.1rem;
}

.eln-list li {
    margin-bottom: 0.75rem;
}

@media print {
    .sidebar,
    .topbar,
    .app-footer,
    .app-modal-header,
    .button-row {
        display: none !important;
    }

    .app-modal-overlay {
        position: static;
        display: block !important;
        background: transparent;
        padding: 0;
    }

    .app-modal {
        max-height: none;
        box-shadow: none;
        width: 100%;
    }

    body.modal-open {
        overflow: visible;
    }
}
