:root {
    --bg: #eef3f8;
    --panel: rgba(255,255,255,0.94);
    --text: #101828;
    --muted: #667085;
    --line: #e4e7ec;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --green: #16a34a;
    --yellow: #d97706;
    --red: #dc2626;
    --navy: #0f172a;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --soft-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34rem),
        radial-gradient(circle at top right, rgba(22, 163, 74, 0.10), transparent 28rem),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand-block {
    display: grid;
    gap: 6px;
    margin-bottom: 32px;
}

.brand-mark {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.brand-subtitle {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

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

.side-nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 700;
}

.side-nav a:hover,
.side-nav a:first-child {
    color: white;
    background: rgba(255,255,255,0.10);
}

.sidebar-footer {
    display: grid;
    gap: 12px;
}

.user-chip {
    color: #cbd5e1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 12px;
    font-size: 13px;
    word-break: break-word;
}

.logout-link {
    color: white;
    text-decoration: none;
    font-weight: 800;
    background: var(--blue);
    padding: 12px 14px;
    border-radius: 14px;
    text-align: center;
}

.main-area {
    padding: 34px;
    max-width: 1480px;
    width: 100%;
}

.hero-bar,
.page-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    margin-bottom: 26px;
    padding: 34px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 64, 175, 0.90));
    color: white;
    box-shadow: var(--shadow);
}

.hero-bar h1,
.page-hero h1 {
    margin: 0;
    font-size: clamp(36px, 4vw, 58px);
    letter-spacing: -0.06em;
    line-height: 0.98;
}

.subtitle,
.hero-bar p,
.page-hero p {
    color: var(--muted);
}

.hero-bar .subtitle,
.page-hero p {
    margin: 16px 0 0;
    color: #dbeafe;
    font-size: 17px;
    max-width: 680px;
}

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

.hero-button,
.primary-action,
.secondary-action,
button,
.view-button,
.edit-button,
.compact-button,
.muted-button,
.danger-button {
    border: 0;
    border-radius: 14px;
    padding: 11px 15px;
    text-decoration: none;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: 0.16s ease;
}

.hero-button,
.primary-action,
button,
.view-button,
.compact-button {
    background: var(--blue);
    color: white;
}

.hero-button:hover,
.primary-action:hover,
button:hover,
.view-button:hover,
.compact-button:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
}

.hero-button.secondary,
.secondary-action,
.edit-button,
.muted-button {
    background: #e5e7eb;
    color: #111827;
}

.danger-button {
    background: #fee2e2;
    color: #991b1b;
}

.danger-button:hover {
    background: #fecaca;
}

.priority-alerts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.priority-alert {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 22px;
    min-height: 150px;
    color: white;
    box-shadow: var(--soft-shadow);
    display: block;
}

.priority-alert::after {
    content: "";
    position: absolute;
    right: -45px;
    top: -45px;
    width: 150px;
    height: 150px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
}

.priority-alert.critical {
    background: linear-gradient(135deg, #991b1b, #ef4444);
}

.priority-alert.warning {
    background: linear-gradient(135deg, #92400e, #f59e0b);
}

.priority-alert.info {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.priority-number {
    font-size: 52px;
    line-height: 1;
    font-weight: 900;
    margin-bottom: 10px;
}

.priority-text {
    opacity: 0.86;
    font-size: 14px;
    margin-top: 6px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.stats-card,
.card,
.panel {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.78);
    border-radius: var(--radius);
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(12px);
}

.stats-card {
    padding: 20px;
}

.stats-value {
    font-size: 34px;
    letter-spacing: -0.04em;
    font-weight: 900;
}

.stats-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-top: 8px;
}

.stats-card.green .stats-value {
    color: var(--green);
}

.stats-card.yellow .stats-value {
    color: var(--yellow);
}

.stats-card.red .stats-value {
    color: var(--red);
}

.card,
.panel {
    padding: 24px;
    margin-bottom: 18px;
}

.card h2,
.panel h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.03em;
}

.card p,
.panel p {
    color: var(--muted);
}

.missing-alert-card {
    background: linear-gradient(180deg, #fff1f2, #ffffff);
    border-color: #fecdd3;
}

.grid,
.two-column {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.crew-health-grid,
.movement-grid {
    display: grid;
    gap: 16px;
}

.crew-health-grid {
    grid-template-columns: repeat(3, 1fr);
}

.movement-grid {
    grid-template-columns: repeat(3, 1fr);
}

.crew-health-card,
.movement-card,
.missing-item,
.list-item {
    background: white;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
}

.crew-health-card.good {
    border-left: 6px solid var(--green);
}

.crew-health-card.check {
    border-left: 6px solid var(--yellow);
}

.crew-health-top,
.missing-item,
.crew-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.crew-health-top h3 {
    margin: 0;
}

.crew-health-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.crew-health-stats strong {
    display: block;
    font-size: 26px;
    letter-spacing: -0.05em;
}

.crew-health-stats span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.completeness-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.completeness-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), #22c55e);
    border-radius: 999px;
}

.missing-list,
.item-list {
    display: grid;
    gap: 10px;
}

.movement-card {
    display: grid;
    gap: 8px;
}

.movement-card a {
    text-decoration: none;
    color: var(--blue);
}

.movement-route,
.movement-card span,
.movement-card small,
.status-message {
    color: var(--muted);
    font-size: 13px;
}

.classification-pill,
.movement-card em {
    justify-self: start;
    font-style: normal;
    color: #3730a3;
    background: #eef2ff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

form {
    margin: 0;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    gap: 14px;
    align-items: end;
}

label {
    display: block;
    font-size: 12px;
    color: #475467;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 900;
    margin-bottom: 6px;
}

input,
select {
    width: 100%;
    border: 1px solid #d0d5dd;
    background: white;
    color: var(--text);
    border-radius: 14px;
    padding: 12px 13px;
    font-size: 14px;
    outline: none;
    margin-bottom: 14px;
}

input:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.secondary-link {
    color: var(--blue);
    font-weight: 800;
    text-decoration: none;
    margin-left: 12px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 840px;
}

th {
    text-align: left;
    padding: 13px 14px;
    color: #475467;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td {
    padding: 16px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

td {
    display: table-cell;
}

td span,
td small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 5px;
}

tbody tr:hover {
    background: #f8fafc;
}

.card {
    overflow-x: auto;
}

.tool-link {
    color: var(--blue);
    text-decoration: none;
}

.tool-link:hover {
    text-decoration: underline;
}

.status-pill,
.confidence-pill,
.mini-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    color: white;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pill.green,
.confidence-pill.green,
.mini-pill.green {
    background: var(--green);
}

.status-pill.yellow,
.confidence-pill.yellow {
    background: var(--yellow);
}

.status-pill.red,
.confidence-pill.red,
.mini-pill.red {
    background: var(--red);
}

.mini-pill.blue {
    background: var(--blue);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.crew-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.crew-list li {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
}

h3 {
    margin: 22px 0 8px;
}

.login-body {
    display: flex;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.login-card {
    background: white;
    width: 380px;
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 12px;
}

.distribution-grid,
.distribution-grid-v2,
.tool-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.distribution-card,
.distribution-card-v2,
.tool-finder-card,
.tool-detail-hero {
    background: white;
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--soft-shadow);
    border: 1px solid var(--line);
}

.distribution-tool,
.distribution-tool-v2 {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    color: var(--text);
    text-decoration: none;
}

.tag-box {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    margin-bottom: 8px;
}

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

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
    }

    .side-nav {
        grid-template-columns: repeat(3, 1fr);
    }

    .main-area {
        padding: 20px;
    }

    .hero-bar,
    .priority-alerts,
    .stats-grid,
    .crew-health-grid,
    .movement-grid,
    .grid,
    .two-column,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .hero-bar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .main-area {
        padding: 14px;
    }

    .hero-bar {
        padding: 24px;
        border-radius: 22px;
    }

    .hero-actions,
    .side-nav {
        width: 100%;
        grid-template-columns: 1fr;
        display: grid;
    }

    .priority-number {
        font-size: 42px;
    }

    .distribution-grid,
    .distribution-grid-v2,
    .tool-card-grid {
        grid-template-columns: 1fr;
    }

    .crew-health-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .missing-item,
    .crew-health-top,
    .crew-list li {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* PATCH 002 — Serious login screen */
.login-body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.22), transparent 32rem),
        radial-gradient(circle at 90% 90%, rgba(22, 163, 74, 0.16), transparent 28rem),
        linear-gradient(135deg, #0f172a 0%, #111827 48%, #1e3a8a 100%);
}

.login-shell {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: 1.25fr 0.85fr;
    gap: 24px;
    align-items: stretch;
}

.login-brand-panel,
.login-card {
    border-radius: 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.login-brand-panel {
    color: white;
    padding: 44px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(18px);
}

.login-badge {
    display: inline-flex;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.20);
    color: #dbeafe;
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login-brand-panel h1 {
    margin: 26px 0 16px;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 0.96;
    letter-spacing: -0.07em;
}

.login-brand-panel p {
    max-width: 620px;
    color: #dbeafe;
    font-size: 17px;
    line-height: 1.6;
}

.login-proof-grid {
    margin-top: 34px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.login-proof-grid div {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 18px;
    padding: 16px;
}

.login-proof-grid strong,
.login-proof-grid span {
    display: block;
}

.login-proof-grid span {
    margin-top: 6px;
    color: #bfdbfe;
    font-size: 13px;
}

.login-card {
    background: white;
    padding: 34px;
    align-self: center;
}

.login-card-header h2 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.04em;
}

.login-card-header p {
    color: #667085;
    margin: 8px 0 24px;
}

.login-submit {
    width: 100%;
    margin-top: 8px;
    padding: 14px 16px;
}

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

    .login-proof-grid {
        grid-template-columns: 1fr;
    }

    .login-brand-panel {
        padding: 30px;
    }
}

/* PATCH 003 — Management page spacing */
.side-nav a:nth-child(4) {
    margin-top: 18px;
    background: rgba(37, 99, 235, 0.16);
    color: white;
}

.side-nav a:nth-child(4):hover {
    background: rgba(37, 99, 235, 0.28);
}

.small-button {
    padding: 8px 11px;
    font-size: 12px;
}

/* PATCH 004 — Operations Feed */
.operations-feed-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
}

.feed-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.feed-live-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.operations-feed {
    display: grid;
    gap: 12px;
}

.feed-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.feed-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 1000;
    color: white;
    background: var(--blue);
}

.feed-item.reconciliation .feed-icon {
    background: var(--green);
}

.feed-item.missing .feed-icon {
    background: var(--red);
}

.feed-item.anomaly .feed-icon {
    background: var(--yellow);
}

.feed-item.movement .feed-icon,
.feed-item.transfer .feed-icon {
    background: #4f46e5;
}

.feed-content {
    min-width: 0;
}

.feed-topline {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.feed-topline strong {
    font-size: 15px;
}

.feed-topline span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.feed-content p {
    margin: 6px 0 10px;
    color: #475467;
    line-height: 1.45;
}

.feed-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feed-meta span {
    border-radius: 999px;
    padding: 5px 9px;
    background: #f1f5f9;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 720px) {
    .feed-header,
    .feed-topline {
        flex-direction: column;
    }

    .feed-item {
        grid-template-columns: 1fr;
    }
}

/* PATCH 005 — Crew operational status system */
.crew-health-card.ready {
    border-left: 6px solid var(--green);
}

.crew-health-card.warning,
.crew-health-card.no-loadout {
    border-left: 6px solid var(--yellow);
}

.crew-health-card.not-scanned,
.crew-health-card.missing-tools,
.crew-health-card.unexpected-tools {
    border-left: 6px solid var(--red);
}

.crew-status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    color: white;
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.crew-status-pill.ready {
    background: var(--green);
}

.crew-status-pill.warning,
.crew-status-pill.no-loadout {
    background: var(--yellow);
}

.crew-status-pill.not-scanned,
.crew-status-pill.missing-tools,
.crew-status-pill.unexpected-tools {
    background: var(--red);
}

.crew-status-reason {
    margin: 10px 0 12px;
    color: #475467;
    font-size: 13px;
    line-height: 1.45;
}

.completeness-fill.ready {
    background: linear-gradient(90deg, var(--green), #22c55e);
}

.completeness-fill.warning,
.completeness-fill.no-loadout {
    background: linear-gradient(90deg, var(--yellow), #f59e0b);
}

.completeness-fill.not-scanned,
.completeness-fill.missing-tools,
.completeness-fill.unexpected-tools {
    background: linear-gradient(90deg, var(--red), #ef4444);
}

/* PATCH 006 — End-of-shift reconciliation */
.reconciliation-card {
    background:
        linear-gradient(180deg, rgba(239,246,255,0.98), rgba(255,255,255,0.96));
    border-color: #bfdbfe;
}

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

.reconciliation-item {
    background: white;
    border: 1px solid var(--line);
    border-left: 6px solid #d0d5dd;
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.reconciliation-item.complete {
    border-left-color: var(--green);
}

.reconciliation-item.pending,
.reconciliation-item.incomplete {
    border-left-color: var(--red);
}

.reconciliation-item.review,
.reconciliation-item.no-loadout {
    border-left-color: var(--yellow);
}

.reconciliation-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.reconciliation-top h3 {
    margin: 0;
    font-size: 18px;
}

.reconciliation-top p {
    color: #475467;
    margin: 7px 0 0;
    line-height: 1.45;
}

.reconciliation-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    color: white;
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.reconciliation-status.complete {
    background: var(--green);
}

.reconciliation-status.pending,
.reconciliation-status.incomplete {
    background: var(--red);
}

.reconciliation-status.review,
.reconciliation-status.no-loadout {
    background: var(--yellow);
}

.reconciliation-progress {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    margin: 16px 0;
}

.reconciliation-progress strong {
    font-size: 18px;
}

.completeness-fill.complete {
    background: linear-gradient(90deg, var(--green), #22c55e);
}

.completeness-fill.pending,
.completeness-fill.incomplete {
    background: linear-gradient(90deg, var(--red), #ef4444);
}

.completeness-fill.review,
.completeness-fill.no-loadout {
    background: linear-gradient(90deg, var(--yellow), #f59e0b);
}

.reconciliation-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.reconciliation-stats div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
}

.reconciliation-stats strong,
.reconciliation-stats span {
    display: block;
}

.reconciliation-stats strong {
    font-size: 22px;
    letter-spacing: -0.04em;
}

.reconciliation-stats span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.reconciliation-meta {
    display: grid;
    gap: 5px;
    color: #475467;
    font-size: 13px;
    margin-bottom: 12px;
}

.reconciliation-tool-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.reconciliation-tool-list strong {
    font-size: 13px;
}

.reconciliation-tool-list a {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.reconciliation-tool-list.missing a {
    background: #fee2e2;
    color: #991b1b;
}

.reconciliation-tool-list.returned a {
    background: #dcfce7;
    color: #166534;
}

@media (max-width: 1000px) {
    .reconciliation-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .reconciliation-top {
        flex-direction: column;
    }

    .reconciliation-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* PATCH 007 — Tool Chain of Custody */
.custody-card {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
}

.custody-timeline {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.custody-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    position: relative;
}

.custody-marker {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 1000;
    background: var(--blue);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.custody-item.end-shift .custody-marker {
    background: var(--green);
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.22);
}

.custody-content {
    background: white;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.custody-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.custody-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.custody-grid div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px;
}

.custody-grid span,
.custody-grid strong {
    display: block;
}

.custody-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 5px;
}

.custody-grid strong {
    font-size: 14px;
}

.custody-tag {
    margin-top: 12px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 900;
    word-break: break-word;
}

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

@media (max-width: 640px) {
    .custody-item {
        grid-template-columns: 1fr;
    }

    .custody-grid {
        grid-template-columns: 1fr;
    }

    .custody-top {
        flex-direction: column;
    }
}

/* PATCH 008 — Morning Readiness Center */
.readiness-card {
    background:
        linear-gradient(180deg, rgba(248,250,252,0.98), rgba(255,255,255,0.98));
}

.readiness-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.readiness-column {
    border-radius: 20px;
    padding: 16px;
    border: 1px solid var(--line);
    background: white;
}

.readiness-column.ready {
    border-top: 6px solid var(--green);
}

.readiness-column.attention {
    border-top: 6px solid var(--yellow);
}

.readiness-column.not-scanned {
    border-top: 6px solid var(--red);
}

.readiness-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.readiness-column-header h3 {
    margin: 0;
    font-size: 14px;
    letter-spacing: 0.08em;
}

.readiness-column-header span {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #f1f5f9;
    font-weight: 900;
}

.readiness-item {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fcfcfd;
}

.readiness-item strong {
    display: block;
    margin-bottom: 6px;
}

.readiness-item p {
    margin: 0;
    color: #475467;
    line-height: 1.45;
    font-size: 13px;
}

.readiness-meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.readiness-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.readiness-pills a {
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    text-decoration: none;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
}

.readiness-empty {
    border: 1px dashed #d0d5dd;
    border-radius: 14px;
    padding: 16px;
    color: var(--muted);
    font-size: 13px;
    background: #fafafa;
}

@media (max-width: 1100px) {
    .readiness-grid {
        grid-template-columns: 1fr;
    }
}

/* PATCH 009 — Multi-tool reconciliation form */
select[multiple] {
    min-height: 210px;
    padding: 10px;
}

select[multiple] option {
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
}

select[multiple] option:checked {
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    color: white;
}

.form-help {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin-top: -8px;
    margin-bottom: 12px;
}

.inline-form .wide-field {
    grid-column: span 2;
}

@media (max-width: 1200px) {
    .inline-form .wide-field {
        grid-column: auto;
    }
}

/* PATCH 009B — Clarify simulator vs manager workflow */
.simulator-note {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
    margin: 14px 0 18px;
}

.accent-panel .simulator-note {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #166534;
}

/* PATCH 010 — Crew custody logs */
.side-nav a[href="/logs"] {
    background: rgba(255,255,255,0.08);
    color: white;
}

.custody-crew-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.custody-crew-card {
    display: block;
    background: white;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 18px;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.custody-crew-card:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
}

.custody-crew-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.custody-crew-top h3 {
    margin: 0;
}

.custody-crew-top span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
}

.custody-crew-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.custody-crew-stats div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
}

.custody-crew-stats strong,
.custody-crew-stats span {
    display: block;
}

.custody-crew-stats strong {
    font-size: 22px;
}

.custody-crew-stats span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.custody-crew-card p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 0;
}

.crew-day-log {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.crew-day-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
}

.crew-day-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.crew-day-header h3 {
    margin: 0;
}

.crew-day-header p {
    color: var(--muted);
    margin: 6px 0 0;
}

.crew-day-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.crew-day-meta span {
    background: #f1f5f9;
    color: #475467;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
}

.day-tool-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.day-tool-columns > div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
}

.day-tool-columns h4 {
    margin: 0 0 10px;
}

.day-tool-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.day-tool-list a {
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.day-tool-list.end a {
    background: #dcfce7;
    color: #166534;
}

.empty-tool-state {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1100px) {
    .custody-crew-grid,
    .day-tool-columns {
        grid-template-columns: 1fr;
    }

    .crew-day-header {
        flex-direction: column;
    }
}

/* PATCH 011 — Missing Tool Investigation */
.investigation-card {
    background:
        linear-gradient(180deg, rgba(248,250,252,0.98), rgba(255,255,255,1));
}

.investigation-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.investigation-badge {
    background: #111827;
    color: white;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
}

.investigation-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.investigation-box {
    background: white;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
}

.investigation-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.investigation-box strong {
    line-height: 1.45;
}

.investigation-recommendation {
    margin-top: 18px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    border-radius: 18px;
    padding: 16px;
    font-weight: 800;
    line-height: 1.5;
}

@media (max-width: 1100px) {
    .investigation-grid {
        grid-template-columns: 1fr;
    }

    .investigation-top {
        flex-direction: column;
    }
}

/* PATCH 012 — Unexpected tools in custody logs */
.custody-day-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 11px;
    color: white;
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.custody-day-status.clean {
    background: var(--green);
}

.custody-day-status.missing,
.custody-day-status.unexpected,
.custody-day-status.mismatch,
.custody-day-status.pending {
    background: var(--red);
}

.custody-day-status.no-loadout {
    background: var(--yellow);
}

.custody-exceptions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 14px;
}

.custody-exception-box {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
}

.custody-exception-box h4 {
    margin: 0 0 10px;
}

.day-tool-list.missing a {
    background: #fee2e2;
    color: #991b1b;
}

.day-tool-list.unexpected a {
    background: #ffedd5;
    color: #9a3412;
}

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

/* PATCH 013 — Expected Location / Where Should It Be */
.expected-location-card {
    border-left: 7px solid #d0d5dd;
}

.expected-location-card.match {
    border-left-color: var(--green);
}

.expected-location-card.mismatch,
.expected-location-card.not-seen {
    border-left-color: var(--red);
}

.expected-location-card.unassigned,
.expected-location-card.unknown {
    border-left-color: var(--yellow);
}

.expected-location-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.expected-location-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    color: white;
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.expected-location-status.match {
    background: var(--green);
}

.expected-location-status.mismatch,
.expected-location-status.not-seen {
    background: var(--red);
}

.expected-location-status.unassigned,
.expected-location-status.unknown {
    background: var(--yellow);
}

.expected-location-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.expected-location-grid div {
    background: white;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
}

.expected-location-grid span,
.expected-location-grid strong {
    display: block;
}

.expected-location-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.expected-location-grid strong {
    line-height: 1.45;
}

.expected-location-message {
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 16px;
    color: #475467;
    font-weight: 800;
    line-height: 1.45;
}

.expected-location-card.match .expected-location-message {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

.expected-location-card.mismatch .expected-location-message,
.expected-location-card.not-seen .expected-location-message {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

@media (max-width: 900px) {
    .expected-location-top {
        flex-direction: column;
    }

    .expected-location-grid {
        grid-template-columns: 1fr;
    }
}
