/* ============================================================
   Video Remote Interpreting — customer app design system
   ============================================================ */
:root {
    --brand-600: #4f46e5;
    --brand-500: #6366f1;
    --brand-700: #4338ca;
    --accent: #2563eb;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --bg: #f1f5f9;
    --danger: #dc2626;
    --success: #16a34a;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, .12), 0 8px 10px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, .25);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .35em; line-height: 1.2; }

/* ---------------- App header + step bar ---------------- */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-header-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; color: #fff;
    background: linear-gradient(135deg, var(--brand-500), var(--accent));
}
.signout-form { margin: 0; }

.stepbar {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px 16px;
}
.stepbar ol {
    list-style: none; display: flex; gap: 8px; margin: 0; padding: 0;
}
.stepbar li {
    display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: .85rem; font-weight: 600;
    flex: 1; min-width: 0;
}
.stepbar li:not(:last-child)::after {
    content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; margin-left: 8px;
}
.stepbar .step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--line); color: var(--muted); font-size: .8rem;
}
.stepbar li.done .step-num { background: var(--success); color: #fff; }
.stepbar li.current .step-num { background: var(--brand-600); color: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,.15); }
.stepbar li.current { color: var(--ink); }

/* ---------------- Main + footer ---------------- */
.app-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 24px; }
.app-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 28px;
}
.card + .card { margin-top: 20px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 1.6rem; }
.page-head p { color: var(--muted); margin: 0; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 18px; }
.form-group label, .form-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: #334155; }
.form-control, select.form-control, textarea.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, select.form-control:focus, textarea.form-control:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
textarea.form-control { min-height: 96px; resize: vertical; }
.field-error, .text-danger { color: var(--danger); font-size: .82rem; margin-top: 4px; display: block; }
.form-hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 18px; font-size: .9rem; color: #334155; }
.checkbox-row input { width: 16px; height: 16px; }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 11px 20px; font-size: .95rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: transform .05s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-primary { background: linear-gradient(135deg, var(--brand-600), var(--accent)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: #334155; }
.btn-ghost:hover { background: #f8fafc; }
.btn-secondary { background: #eef2ff; color: var(--brand-700); }
.btn-secondary:hover { background: #e0e7ff; }

/* ---------------- Auth (login) ---------------- */
.auth-body { background: radial-gradient(1200px 600px at 50% -10%, #1e293b 0%, #0f172a 60%, #020617 100%); }
.auth-shell { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 18px; min-height: 100vh; }
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 36px 32px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 60px; height: 60px; border-radius: 16px; margin-bottom: 14px;
    background: linear-gradient(135deg, var(--brand-500), var(--accent));
    box-shadow: 0 8px 20px -6px rgba(79,70,229,.6);
}
.auth-title { font-size: 1.45rem; }
.auth-subtitle { color: var(--muted); margin: 0; font-size: .95rem; }
.auth-error:not(:empty) {
    background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
    border-radius: var(--radius-sm); padding: 10px 14px; font-size: .88rem; margin-bottom: 16px;
}
.auth-error ul { margin: 0; padding-left: 18px; }
.auth-footnote { text-align: center; color: var(--muted); font-size: .82rem; margin: 18px 0 0; }

/* ---------------- Language selection ---------------- */
.lang-section-title { font-size: 1rem; font-weight: 700; color: #334155; margin: 4px 0 14px; }
.lang-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 820px) { .lang-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .lang-grid { grid-template-columns: repeat(2, 1fr); } }
.lang-tile {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; padding: 18px 12px; text-align: center;
    font-weight: 600; color: var(--ink); cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .08s, background .15s;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.lang-tile:hover { border-color: var(--brand-500); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.lang-tile.selected { border-color: var(--brand-600); background: #eef2ff; box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.lang-flag {
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #e0e7ff, #dbeafe); color: var(--brand-700);
    font-weight: 700; font-size: 1rem;
}
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: .9rem;
}
.test-card {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-style: dashed;
}
.test-card .btn { flex: none; white-space: nowrap; }
.lang-search { margin: 6px 0 16px; }
.divider { height: 1px; background: var(--line); margin: 26px 0; border: 0; }

/* Filterable full language list (search box + click-to-connect items). */
.lang-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
@media (max-width: 820px) { .lang-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .lang-list { grid-template-columns: 1fr; } }
.lang-item {
    text-align: left;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: inherit;
}
.lang-item:hover { background: #eef2ff; border-color: var(--brand-500); }
.lang-no-match { color: #6b7280; margin: 10px 4px 0; font-size: 14px; }

/* Connection-type (VRI vs OPI) selection tiles. */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .mode-grid { grid-template-columns: 1fr; } }
.mode-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.mode-tile:hover { border-color: var(--brand-500); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mode-icon {
    width: 58px; height: 58px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: #eef2ff; color: var(--brand-600);
}
.mode-name { font-size: 17px; font-weight: 600; }
.mode-desc { color: #6b7280; font-size: 14px; line-height: 1.45; }
