:root {
    --bg: #edf5ff;
    --bg-alt: #f7fbff;
    --surface: rgba(247, 251, 255, 0.84);
    --surface-strong: #eef6ff;
    --surface-dark: #0d1b2a;
    --text: #102033;
    --muted: #5e7390;
    --line: rgba(19, 37, 48, 0.12);
    --accent: #1f6feb;
    --accent-2: #0f4fcf;
    --accent-3: #69a8ff;
    --danger: #a23d3d;
    --success: #1f7a4c;
    --warning: #92620f;
    --shadow: 0 24px 60px rgba(15, 45, 92, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --content-width: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(105, 168, 255, 0.34), transparent 30%),
        radial-gradient(circle at right 20%, rgba(31, 111, 235, 0.18), transparent 22%),
        linear-gradient(180deg, #eef6ff 0%, #e7f1ff 44%, #f3f8ff 100%);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(19, 37, 48, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 37, 48, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    pointer-events: none;
    z-index: -1;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

.container {
    width: min(calc(100% - 2rem), var(--content-width));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(16px);
    background: rgba(237, 245, 255, 0.78);
    border-bottom: 1px solid rgba(19, 37, 48, 0.08);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #64a3ff);
    color: #fff;
    box-shadow: 0 16px 24px rgba(31, 111, 235, 0.25);
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    padding: 0.8rem 1rem;
    border-radius: 999px;
    color: var(--muted);
    transition: 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(19, 37, 48, 0.06);
    color: var(--text);
}

.btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0.95rem 1.3rem;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #64a3ff);
    box-shadow: 0 20px 30px rgba(31, 111, 235, 0.22);
}

.btn-secondary {
    color: var(--text);
    background: rgba(19, 37, 48, 0.06);
}

.btn-outline {
    color: var(--text);
    background: transparent;
    border: 1px solid rgba(19, 37, 48, 0.14);
}

.hero {
    padding: 5rem 0 3rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 2rem;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.1);
    color: var(--accent-2);
    font-size: 0.92rem;
    font-weight: 700;
}

h1,
h2,
h3 {
    margin: 0 0 0.9rem;
    line-height: 1.04;
    font-family: Georgia, "Times New Roman", serif;
}

h1 {
    font-size: clamp(3rem, 7vw, 5.5rem);
    letter-spacing: -0.04em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3.3rem);
    letter-spacing: -0.03em;
}

h3 {
    font-size: 1.3rem;
}

.lead {
    max-width: 64ch;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.7;
}

.hero-actions,
.section-actions,
.stack {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    align-items: center;
}

.hero-card,
.glass-card,
.panel,
.metric,
.table-wrap {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-card {
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    overflow: hidden;
}

.hero-stack {
    display: grid;
    gap: 1rem;
}

.mini-card {
    padding: 1.2rem;
    background: linear-gradient(180deg, rgba(238, 246, 255, 0.96), rgba(248, 251, 255, 0.9));
    border-radius: 22px;
    border: 1px solid rgba(19, 37, 48, 0.08);
}

.mini-card strong,
.metric-value {
    display: block;
    font-size: 1.8rem;
    font-family: Georgia, "Times New Roman", serif;
}

.mini-card p,
.metric-label,
.muted {
    color: var(--muted);
}

.section {
    padding: 3rem 0;
}

.section-intro {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.4rem;
}

.grid-3,
.grid-2,
.metrics-grid,
.dashboard-grid,
.tool-grid,
.form-grid,
.stage-grid,
.meta-grid {
    display: grid;
    gap: 1.2rem;
}

.grid-3,
.tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2,
.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-grid {
    grid-template-columns: 1fr;
}

.meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-card,
.panel,
.metric {
    border-radius: var(--radius-md);
    padding: 1.35rem;
}

.feature-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 250, 242, 0.92));
    border: 1px solid rgba(19, 37, 48, 0.08);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: 1rem;
    color: #fff;
    font-weight: 800;
}

.feature-icon.orange {
    background: linear-gradient(135deg, var(--accent), #64a3ff);
}

.feature-icon.teal {
    background: linear-gradient(135deg, var(--accent-2), #3e7bff);
}

.feature-icon.gold {
    background: linear-gradient(135deg, #2563eb, #8ab8ff);
}

.metric {
    padding: 1.3rem 1.4rem;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
    padding: 1.5rem;
}

.stage-panel {
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h3,
.table-wrap h3 {
    margin-bottom: 0.2rem;
}

.table-wrap {
    border-radius: var(--radius-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid rgba(19, 37, 48, 0.08);
    vertical-align: top;
}

th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.badge-success {
    color: var(--success);
    background: rgba(31, 122, 76, 0.12);
}

.badge-warning {
    color: var(--warning);
    background: rgba(166, 106, 18, 0.14);
}

.badge-danger {
    color: var(--danger);
    background: rgba(162, 61, 61, 0.14);
}

.badge-neutral {
    color: var(--muted);
    background: rgba(97, 112, 122, 0.12);
}

.flash-stack {
    display: grid;
    gap: 0.8rem;
    margin: 1.2rem 0 1.4rem;
}

.flash {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px solid transparent;
}

.flash-success {
    background: rgba(31, 122, 76, 0.12);
    border-color: rgba(31, 122, 76, 0.2);
    color: #164d32;
}

.flash-error {
    background: rgba(162, 61, 61, 0.12);
    border-color: rgba(162, 61, 61, 0.18);
    color: #6f2525;
}

.flash-warning {
    background: rgba(166, 106, 18, 0.14);
    border-color: rgba(166, 106, 18, 0.2);
    color: #754b0d;
}

.flash-info {
    background: rgba(31, 111, 235, 0.1);
    border-color: rgba(31, 111, 235, 0.16);
    color: #173f86;
}

.auth-shell,
.dashboard-shell,
.tool-shell {
    padding: 3rem 0 4rem;
}

.auth-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 1.7rem;
    border-radius: var(--radius-lg);
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.field {
    margin-bottom: 1rem;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(19, 37, 48, 0.12);
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
    font: inherit;
    padding: 0.95rem 1rem;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(31, 111, 235, 0.45);
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.12);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.field-help {
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.terminal-panel {
    margin-bottom: 1.5rem;
}

.terminal-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.terminal-select-field {
    min-width: 280px;
    margin-bottom: 0;
}

.terminal-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.terminal-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.terminal-meta-item {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(19, 37, 48, 0.05);
}

.terminal-note {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(31, 111, 235, 0.08);
    color: var(--text);
}

.terminal-output {
    margin: 1rem 0 0;
    padding: 1rem;
    border-radius: 18px;
    background: #071320;
    color: #dbe9ff;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92rem;
    line-height: 1.55;
    overflow: auto;
    max-height: 520px;
    min-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(105, 168, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.run-toolbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.meta-item {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(19, 37, 48, 0.05);
}

.compact-list {
    gap: 0.65rem;
}

.compact-list li {
    padding: 0.8rem 0.95rem;
}

.log-preview {
    margin: 0.7rem 0 0;
    padding: 1rem;
    border-radius: 16px;
    background: #0d1b2a;
    color: #dbe9ff;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow: auto;
    max-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}

.split-callout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 1rem;
    align-items: stretch;
}

.callout {
    padding: 1.2rem 1.3rem;
    border-radius: 22px;
    border: 1px solid rgba(19, 37, 48, 0.08);
    background: linear-gradient(180deg, rgba(238, 246, 255, 0.96), rgba(255, 255, 255, 0.9));
}

.stack-list {
    display: grid;
    gap: 0.8rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.stack-list li {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(19, 37, 48, 0.05);
}

.kicker {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.site-footer {
    padding: 1.4rem 0 3rem;
    color: var(--muted);
}

.site-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(19, 37, 48, 0.08);
}

.empty-state {
    padding: 1.1rem;
    border-radius: 18px;
    background: rgba(19, 37, 48, 0.04);
    color: var(--muted);
}

.intake-panel {
    margin-bottom: 1.5rem;
}

.intake-card {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(19, 37, 48, 0.04);
    border: 1px solid rgba(19, 37, 48, 0.08);
}

.intake-recommendations {
    margin: 0.9rem 0 0;
}

.recommendation-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
}

.recommendation-group {
    display: grid;
    gap: 0.8rem;
}

.recommendation-list {
    display: grid;
    gap: 0.75rem;
}

.recommendation-item {
    padding: 0.95rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(19, 37, 48, 0.08);
}

.recommendation-pair {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.recommendation-actions {
    margin-top: 0.8rem;
}

.intake-mentions-card {
    margin-bottom: 1rem;
}

.mention-bar-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.mention-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1rem;
}

.mention-chip {
    display: grid;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(19, 37, 48, 0.08);
    min-width: 240px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.mention-chip-repeat {
    border-color: rgba(31, 111, 235, 0.28);
    box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.08);
}

.mention-chip-ignored {
    background: rgba(19, 37, 48, 0.05);
    border-style: dashed;
}

.mention-chip-main,
.mention-chip-actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.mention-chip-label {
    font-size: 0.96rem;
}

.mention-chip-actions form {
    margin: 0;
}

.repeat-row {
    background: rgba(31, 111, 235, 0.04);
}

.btn-small {
    padding: 0.55rem 0.8rem;
    font-size: 0.9rem;
}

.table-wrap {
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(19, 37, 48, 0.08);
    background: rgba(255, 255, 255, 0.92);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.data-table th,
.data-table td {
    padding: 0.9rem 0.95rem;
    border-bottom: 1px solid rgba(19, 37, 48, 0.08);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    position: sticky;
    top: 0;
    background: #eef5ff;
    color: var(--text);
    font-size: 0.86rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: rgba(31, 111, 235, 0.05);
}

.intake-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.intake-checkbox input {
    width: 1rem;
    height: 1rem;
}

.hidden-inline-form {
    display: none;
}

.tool-hero {
    margin-bottom: 1.4rem;
}

.inline-code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.94em;
    background: rgba(19, 37, 48, 0.07);
    padding: 0.18rem 0.42rem;
    border-radius: 8px;
}

@media (max-width: 980px) {
    .hero-grid,
    .grid-3,
    .grid-2,
    .metrics-grid,
    .dashboard-grid,
    .split-callout,
    .tool-grid,
    .form-grid,
    .terminal-meta {
        grid-template-columns: 1fr;
    }

    .section-intro,
    .panel-header,
    .site-footer-inner,
    .site-header-inner {
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .hero {
        padding-top: 3.4rem;
    }

    h1 {
        font-size: clamp(2.5rem, 14vw, 4rem);
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
    }

    .site-header-inner {
        flex-direction: column;
    }

    th,
    td {
        padding: 0.8rem;
    }
}

.work-order-tool .tool-hero {
    margin-bottom: 1.2rem;
}

.work-order-status-panel {
    margin-bottom: 1.2rem;
}

.work-order-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.work-order-status-grid > div {
    padding: 1rem;
    border-radius: 16px;
    background: rgba(19, 37, 48, 0.05);
    min-width: 0;
}

.work-order-status-grid strong {
    display: block;
    margin-top: 0.35rem;
    overflow-wrap: anywhere;
}

.work-order-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
    gap: 1.2rem;
    align-items: start;
}

.capture-panel,
.review-panel {
    min-width: 0;
}

.camera-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 18px;
    background: #0d1b2a;
    border: 1px solid rgba(19, 37, 48, 0.12);
    margin-bottom: 1rem;
}

.camera-frame video,
.camera-frame .empty-state {
    width: 100%;
    height: 100%;
}

.camera-frame video {
    display: block;
    object-fit: cover;
}

.camera-frame .empty-state {
    display: grid;
    place-items: center;
    color: #dbe9ff;
    background: #0d1b2a;
}

.camera-frame .empty-state[hidden] {
    display: none;
}

.file-pick-button {
    margin: 0;
}

#workOrderImages {
    display: none;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.85rem;
    margin: 1rem 0;
}

.image-preview-grid figure {
    margin: 0;
    padding: 0.55rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(19, 37, 48, 0.08);
}

.image-preview-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 10px;
    background: #fff;
}

.image-preview-grid figcaption {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 0.45rem;
}

.work-order-form-grid,
.search-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.search-form-grid {
    align-items: end;
}

.work-order-wide {
    grid-column: 1 / -1;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    margin: 0;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: rgba(19, 37, 48, 0.05);
}

.checkbox-grid input {
    width: 1rem;
    height: 1rem;
    padding: 0;
}

.repeat-section {
    margin-top: 1.2rem;
}

.repeat-table-wrap {
    overflow-x: auto;
}

.repeat-table {
    min-width: 820px;
}

.repeat-table input,
.repeat-table textarea {
    min-width: 120px;
    border-radius: 12px;
    padding: 0.75rem 0.8rem;
}

.repeat-table textarea {
    min-height: 64px;
}

.confirm-actions {
    margin-top: 1.2rem;
}

.warning-list {
    margin-bottom: 1rem;
}

.search-panel {
    margin-top: 1.2rem;
}

.search-button-field {
    align-self: end;
}

.search-results {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.search-result-card {
    border-radius: 18px;
    border: 1px solid rgba(19, 37, 48, 0.08);
    background: rgba(255, 255, 255, 0.86);
    overflow: hidden;
}

.search-result-card summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
}

.search-result-card summary span:first-child {
    display: grid;
    gap: 0.2rem;
}

.search-result-body {
    display: grid;
    gap: 1rem;
    padding: 0 1rem 1rem;
}

.search-result-body h3 {
    margin: 0;
}

.nested-table-wrap {
    box-shadow: none;
}

.nested-table {
    min-width: 620px;
}

@media (max-width: 980px) {
    .work-order-status-grid,
    .work-order-layout,
    .work-order-form-grid,
    .search-form-grid {
        grid-template-columns: 1fr;
    }

    .checkbox-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .work-order-tool .section-actions {
        align-items: stretch;
    }

    .work-order-tool .section-actions .btn,
    .work-order-tool .section-actions button {
        width: 100%;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .search-result-card summary {
        align-items: flex-start;
        flex-direction: column;
    }
}
