:root {
    --color-bg: #f4f6f9;
    --color-surface: #ffffff;
    --color-border: #e1e5eb;
    --color-text: #1c2430;
    --color-text-muted: #667085;
    --color-primary: #1d4ed8;
    --color-primary-dark: #1a3fb0;
    --color-primary-soft: #eaf0ff;
    --color-danger: #d92d20;
    --color-danger-soft: #fef3f2;
    --color-success: #027a48;
    --color-success-soft: #ecfdf3;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-text);
}
.brand-logo {
    height: 32px;
    width: auto;
    display: block;
}
.brand-text {
    display: block;
}
.brand-text span {
    display: block;
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.92rem;
}
.nav-links a { color: var(--color-text-muted); font-weight: 600; }
.nav-links a:hover { color: var(--color-primary); text-decoration: none; }
.nav-user {
    color: var(--color-text);
    font-weight: 600;
    padding-left: 10px;
    border-left: 1px solid var(--color-border);
}
.logout-form { display: inline; }
.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
}
.link-button:hover { color: var(--color-danger); }

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}
.page-narrow { max-width: 520px; }

.page-header { margin-bottom: 24px; }
.page-header h1 { margin: 0 0 4px; font-size: 1.5rem; }
.page-header p { margin: 0; color: var(--color-text-muted); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}
.card + .card { margin-top: 20px; }

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.88rem; }
.field .hint { font-size: 0.8rem; color: var(--color-text-muted); }
.field .error { font-size: 0.8rem; color: var(--color-danger); }

input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
textarea { resize: vertical; min-height: 110px; }

.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
}
.radio-option input { margin-top: 3px; }
.radio-option strong { display: block; font-size: 0.92rem; }
.radio-option span.desc { font-size: 0.8rem; color: var(--color-text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { border-color: var(--color-primary); text-decoration: none; }
.btn-block { width: 100%; }
.btn-fixed { width: 84px; padding-left: 0; padding-right: 0; box-sizing: border-box; }
form:has(> .btn-fixed) { display: block; margin: 0; }

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
}
.btn-pill:hover { border-color: var(--color-primary); text-decoration: none; }
form:has(> .btn-pill) { display: inline-block; margin: 0; }

.btn-pill-indigo { background: #eef2ff; color: #3730a3; border-color: transparent; }
.btn-pill-indigo:hover { background: #e0e7ff; border-color: transparent; }
.btn-pill-blue { background: #eaf0ff; color: #1d4ed8; border-color: transparent; }
.btn-pill-blue:hover { background: #dbe7ff; border-color: transparent; }
.btn-pill-danger { background: var(--color-danger-soft); color: var(--color-danger); border-color: transparent; }
.btn-pill-danger:hover { background: #fee4e2; border-color: transparent; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 18px;
}
.alert-error { background: var(--color-danger-soft); color: var(--color-danger); border: 1px solid #fda29b; }
.alert-success { background: var(--color-success-soft); color: var(--color-success); border: 1px solid #6ce9a6; }
.alert-info { background: var(--color-primary-soft); color: var(--color-primary-dark); border: 1px solid #b2ccff; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--color-border); vertical-align: top; white-space: nowrap; }
th { color: var(--color-text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:hover { background: #fafbfd; }
.table-wrap { overflow-x: auto; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-received { background: #fff6e0; color: #93650a; }
.badge-inbound_complete { background: #eaf0ff; color: #1d4ed8; }
.badge-in_repair { background: #fdf0d5; color: #b54708; }
.badge-repair_complete { background: #ecfdf3; color: #027a48; }
.badge-shipped_out { background: #eef2ff; color: #3730a3; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}
.filter-chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.filter-chip:hover { text-decoration: none; border-color: var(--color-primary); }

.tracking-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}
.muted { color: var(--color-text-muted); }
.empty-state { text-align: center; padding: 48px 20px; color: var(--color-text-muted); }

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h1 { margin: 0 0 6px; font-size: 1.4rem; }
.auth-header p { margin: 0; color: var(--color-text-muted); font-size: 0.9rem; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 0.88rem; color: var(--color-text-muted); }

.support-note {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.invite-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: Consolas, monospace;
    font-size: 0.82rem;
    overflow-x: auto;
    white-space: nowrap;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 24px;
    font-size: 0.9rem;
}
.detail-grid dt { color: var(--color-text-muted); font-weight: 600; margin-bottom: 2px; }
.detail-grid dd { margin: 0 0 12px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.back-link { display: inline-block; margin-bottom: 14px; font-size: 0.88rem; font-weight: 600; }
