/*
 * qr.contact app shell: a TailAdmin-style layout (sidebar, sticky header,
 * bordered cards) with light and dark themes. All colours are tokens.
 */

:root {
    --brand-25: #f2f7ff;
    --brand-50: #ecf3ff;
    --brand-100: #dde9ff;
    --brand-300: #9cb9ff;
    --brand-500: #465fff;
    --brand-600: #3641f5;
    --brand-700: #2a31d8;

    --gray-25: #fcfcfd;
    --gray-50: #f9fafb;
    --gray-100: #f2f4f7;
    --gray-200: #e4e7ec;
    --gray-300: #d0d5dd;
    --gray-400: #98a2b3;
    --gray-500: #667085;
    --gray-600: #475467;
    --gray-700: #344054;
    --gray-800: #1d2939;
    --gray-900: #101828;

    --page: var(--gray-50);
    --surface: #ffffff;
    --surface-muted: var(--gray-50);
    --surface-sunken: var(--gray-100);
    --line: var(--gray-200);
    --line-strong: var(--gray-300);
    --ink: var(--gray-800);
    --ink-strong: var(--gray-900);
    --ink-2: var(--gray-700);
    --ink-muted: var(--gray-500);
    --ink-faint: var(--gray-400);
    --accent: var(--brand-500);
    --accent-hover: var(--brand-600);
    --accent-soft: var(--brand-50);
    --accent-ink: var(--brand-500);
    --chart-1: #465fff;
    --focus-ring: 0 0 0 4px rgba(70, 95, 255, .12);

    --ok-bg: #ecfdf3;  --ok-ink: #039855;
    --warn-bg: #fffaeb; --warn-ink: #b54708;
    --bad-bg: #fef3f2;  --bad-ink: #d92d20;
    --info-bg: var(--brand-50); --info-ink: var(--brand-500);

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
    --radius: 16px;
    --radius-sm: 8px;
    --sidebar-w: 290px;
    --header-h: 76px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --page: #0c111d;
        --surface: #1d2433;
        --surface-muted: #161c2a;
        --surface-sunken: #252d3e;
        --line: #2b3446;
        --line-strong: #3a4459;
        --ink: #e4e7ec;
        --ink-strong: #ffffff;
        --ink-2: #d0d5dd;
        --ink-muted: #98a2b3;
        --ink-faint: #7a8699;
        --accent: #465fff;
        --accent-hover: #5a74ff;
        --accent-soft: rgba(70, 95, 255, .16);
        --accent-ink: #9cb3ff;
        --chart-1: #6b86ff;
        --ok-bg: rgba(18, 183, 106, .14);  --ok-ink: #6ce9a6;
        --warn-bg: rgba(247, 144, 9, .14); --warn-ink: #fec84b;
        --bad-bg: rgba(240, 68, 56, .14);  --bad-ink: #fda29b;
        --info-bg: rgba(70, 95, 255, .16); --info-ink: #9cb3ff;
        --shadow-md: 0 12px 16px -4px rgba(0, 0, 0, .35);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --page: #0c111d;
    --surface: #1d2433;
    --surface-muted: #161c2a;
    --surface-sunken: #252d3e;
    --line: #2b3446;
    --line-strong: #3a4459;
    --ink: #e4e7ec;
    --ink-strong: #ffffff;
    --ink-2: #d0d5dd;
    --ink-muted: #98a2b3;
    --ink-faint: #7a8699;
    --accent: #465fff;
    --accent-hover: #5a74ff;
    --accent-soft: rgba(70, 95, 255, .16);
    --accent-ink: #9cb3ff;
    --chart-1: #6b86ff;
    --ok-bg: rgba(18, 183, 106, .14);  --ok-ink: #6ce9a6;
    --warn-bg: rgba(247, 144, 9, .14); --warn-ink: #fec84b;
    --bad-bg: rgba(240, 68, 56, .14);  --bad-ink: #fda29b;
    --info-bg: rgba(70, 95, 255, .16); --info-ink: #9cb3ff;
    --shadow-md: 0 12px 16px -4px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body.ta-body {
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
    font-family: Outfit, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.ta-body a { color: var(--accent-ink); text-decoration: none; }
.ta-body a:hover { text-decoration: underline; }
.ta-body code, .ta-body pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- Layout ---------- */

.ta-shell { display: flex; min-height: 100vh; }

.ta-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    padding: 0 20px 20px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    transition: transform .2s ease;
}

.ta-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-h);
    color: var(--ink-strong) !important;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    text-decoration: none !important;
}

/* The product mark, from public/brand/logo.svg. */
.ta-brand-mark {
    display: block;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.ta-nav-group { margin: 18px 0 8px; color: var(--ink-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.ta-nav { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }

.ta-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.ta-nav a:hover { background: var(--surface-sunken); text-decoration: none; }
.ta-nav a.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.ta-nav svg { flex: none; width: 22px; height: 22px; stroke: currentColor; }
.ta-nav a:not(.is-active) svg { color: var(--ink-muted); }

.ta-sidebar-foot {
    margin-top: auto;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface-muted);
    color: var(--ink-muted);
    font-size: 12px;
}
.ta-sidebar-foot strong { display: block; color: var(--ink); font-size: 13px; }
/* Sits at the bottom of the sidebar, under the workspace card when there is one. */
.ta-sidebar-legal { margin: auto 0 0; padding-top: 12px; color: var(--ink-faint); font-size: 12px; }
.ta-sidebar-foot + .ta-sidebar-legal { margin-top: 12px; }
.ta-sidebar-legal a { color: var(--ink-muted); }

.ta-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }

.ta-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--header-h);
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.ta-header-title { min-width: 0; margin-right: auto; }
.ta-header-title h1 { margin: 0; color: var(--ink-strong); font-size: 18px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ta-header-title p { margin: 0; color: var(--ink-muted); font-size: 13px; }

.ta-icon-btn {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-muted);
    cursor: pointer;
}
.ta-icon-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.ta-icon-btn svg { width: 20px; height: 20px; stroke: currentColor; }
.ta-menu-toggle { display: none; border-radius: var(--radius-sm); }

.ta-theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .ta-theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .ta-theme-toggle .icon-moon { display: none; }

.ta-workspace-switch { display: flex; align-items: center; gap: 6px; margin: 0; }
.ta-workspace-switch select { max-width: 220px; }

.ta-user { position: relative; }
.ta-user > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    color: var(--ink-2);
    font-weight: 500;
    list-style: none;
    cursor: pointer;
}
.ta-user > summary::-webkit-details-marker { display: none; }
.ta-user > summary:hover { background: var(--surface-sunken); }
.ta-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-size: 15px;
    font-weight: 600;
}
.ta-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 240px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}
.ta-user-menu .who { padding: 4px 8px 10px; border-bottom: 1px solid var(--line); }
.ta-user-menu .who strong { display: block; color: var(--ink); }
.ta-user-menu .who span { color: var(--ink-muted); font-size: 13px; overflow-wrap: anywhere; }
.ta-user-menu a, .ta-user-menu button {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-2);
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.ta-user-menu a:hover, .ta-user-menu button:hover { background: var(--surface-sunken); text-decoration: none; }
.ta-user-menu form { margin: 0; }

.ta-content { max-width: 1440px; margin: 0 auto; padding: 24px; }

.ta-backdrop { display: none; }

@media (max-width: 1023px) {
    .ta-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
    .ta-shell.is-nav-open .ta-sidebar { transform: none; }
    .ta-shell.is-nav-open .ta-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(16, 24, 40, .45); }
    .ta-main { margin-left: 0; }
    .ta-menu-toggle { display: inline-grid; }
    .ta-workspace-switch { display: none; }
}

@media (max-width: 640px) {
    .ta-header { padding: 10px 16px; gap: 8px; }
    .ta-content { padding: 16px; }
    .ta-user-name, .ta-header-title p { display: none; }
}

/* ---------- Components ---------- */

.ta-stack { display: flex; flex-direction: column; gap: 24px; }
.ta-grid { display: grid; gap: 24px; }
.ta-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ta-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ta-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ta-grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1199px) { .ta-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ta-grid-main { grid-template-columns: 1fr; } }
@media (max-width: 767px) { .ta-grid-2, .ta-grid-3, .ta-grid-4 { grid-template-columns: 1fr; } }

.ta-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.ta-card-body { padding: 24px; }
.ta-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}
.ta-card-head.flush { border-bottom: 0; padding-bottom: 0; }
.ta-card-title { margin: 0; color: var(--ink); font-size: 18px; font-weight: 600; line-height: 1.4; }
.ta-card-sub { margin: 2px 0 0; color: var(--ink-muted); font-size: 14px; }
.ta-card-foot { padding: 16px 24px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .ta-card-body { padding: 16px; } .ta-card-head { padding: 16px; } .ta-card-foot { padding: 12px 16px; } }

.ta-muted { color: var(--ink-muted); }
.ta-small { font-size: 12px; }
.ta-section-title { margin: 0 0 12px; color: var(--ink); font-size: 15px; font-weight: 600; }

.ta-stat { padding: 20px 24px; }
.ta-stat-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--surface-sunken);
    color: var(--ink);
}
.ta-stat-icon svg { width: 24px; height: 24px; stroke: currentColor; }
.ta-stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 20px; }
.ta-stat-label { display: block; color: var(--ink-muted); font-size: 14px; }
.ta-stat-value { display: block; margin-top: 6px; color: var(--ink-strong); font-size: 30px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ta-stat-value.is-small { font-size: 18px; font-weight: 600; }

/* A checkbox with its label on one line. */
.ta-check {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    font-size: 14px;
    color: var(--ink-soft);
}
.ta-check input { width: auto; margin: 0; }

/* Tab strip: switches between views of the same list. */
.ta-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
}
.ta-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px 10px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -3px;
}
.ta-tab:hover { color: var(--ink); background: var(--surface-sunken); }
.ta-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.ta-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--surface-sunken);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
}
.ta-badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.ta-badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.ta-badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.ta-badge.info { background: var(--info-bg); color: var(--info-ink); }

.ta-alert { margin: 0 0 16px; padding: 12px 16px; border: 1px solid transparent; border-radius: 12px; font-size: 14px; }
.ta-alert.ok { border-color: var(--ok-bg); background: var(--ok-bg); color: var(--ok-ink); }
.ta-alert.bad { border-color: var(--bad-bg); background: var(--bad-bg); color: var(--bad-ink); }
.ta-alert.warn { border-color: var(--warn-bg); background: var(--warn-bg); color: var(--warn-ink); }

.ta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    color: var(--ink-2);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.ta-btn:hover { background: var(--surface-sunken); }
.ta-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ta-btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.ta-btn.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.ta-btn.danger { border-color: var(--bad-bg); background: var(--bad-bg); color: var(--bad-ink); }
.ta-btn.danger:hover { border-color: var(--bad-ink); }
.ta-btn.sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.ta-btn.block { width: 100%; }
.ta-btn[disabled] { opacity: .5; cursor: not-allowed; }

.ta-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.ta-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ta-label { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.ta-hint { color: var(--ink-muted); font-size: 12px; }

.ta-input, .ta-select, .ta-textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: transparent;
    box-shadow: var(--shadow-xs);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
}
.ta-select { padding-right: 32px; background-color: var(--surface); }
.ta-input.sm, .ta-select.sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.ta-input::placeholder, .ta-textarea::placeholder { color: var(--ink-faint); }
.ta-input:focus, .ta-select:focus, .ta-textarea:focus { outline: none; border-color: var(--brand-300); box-shadow: var(--focus-ring); }
.ta-textarea { min-height: 120px; resize: vertical; }

.ta-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.ta-table .ta-inline-form { flex-wrap: nowrap; }
.ta-table .ta-actions { flex-wrap: nowrap; }
.ta-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ta-filters .ta-input { flex: 1 1 220px; width: auto; }
.ta-filters .ta-select { width: auto; }

.ta-segment { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--surface-sunken); }
.ta-segment a { padding: 6px 12px; border-radius: 6px; color: var(--ink-muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.ta-segment a:hover { color: var(--ink); text-decoration: none; }
.ta-segment a.is-active { background: var(--surface); box-shadow: var(--shadow-xs); color: var(--ink); }

.ta-table-wrap { overflow-x: auto; }
.ta-table { width: 100%; border-collapse: collapse; }
.ta-table th, .ta-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.ta-table thead th { color: var(--ink-muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.ta-table tbody td { color: var(--ink-2); font-size: 14px; }
.ta-table tbody tr:last-child td { border-bottom: 0; }
.ta-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ta-table .strong { color: var(--ink); font-weight: 500; }
.ta-table .sub { display: block; color: var(--ink-muted); font-size: 12px; }
.ta-table-empty { padding: 32px 16px !important; color: var(--ink-muted); text-align: center; }
.ta-table th:first-child, .ta-table td:first-child { padding-left: 24px; }
.ta-table th:last-child, .ta-table td:last-child { padding-right: 24px; }

.ta-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.ta-dl dt { color: var(--ink-muted); }
.ta-dl dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.ta-list { margin: 0; padding: 0; list-style: none; }
.ta-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ta-list li:last-child { border-bottom: 0; }
.ta-empty { padding: 24px; border-radius: 12px; background: var(--surface-muted); color: var(--ink-muted); text-align: center; }

.ta-copy { display: flex; gap: 8px; }
.ta-copy .ta-input { flex: 1; min-width: 0; }
.ta-input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.ta-code-block { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-muted); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Laravel's Tailwind pagination markup, restyled without Tailwind. */
.ta-pagination nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.ta-pagination nav > div:first-child { display: none; }
.ta-pagination nav > div:last-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.ta-pagination p { margin: 0; color: var(--ink-muted); font-size: 13px; }
.ta-pagination span.relative, .ta-pagination nav > div:last-child > div:last-child > span { display: inline-flex; gap: 4px; }
.ta-pagination a, .ta-pagination span[aria-current] > span, .ta-pagination span[aria-disabled] > span {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 13px;
    text-decoration: none;
}
.ta-pagination span[aria-current] > span { border-color: var(--accent); background: var(--accent); color: #fff; }
.ta-pagination span[aria-disabled] > span { opacity: .45; }
.ta-pagination svg { width: 16px; height: 16px; }

/* Generator page inside the shell */
.ta-generator .page { max-width: none; padding: 0; }
.ta-generator .hero-intro { margin-top: 0; }
