:root,
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
}

body {
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin: 0;
}

table {
    border-collapse: collapse;
    border-color: inherit;
    text-indent: 0;
}

button,
input,
optgroup,
select,
textarea {
    font: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
}

button,
select {
    text-transform: none;
}

button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
    appearance: button;
    background-color: transparent;
    background-image: none;
    border: 0;
}

button,
[role="button"] {
    cursor: pointer;
}

button:disabled,
:disabled {
    cursor: default;
}

img,
iframe,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
    vertical-align: middle;
}

img,
video {
    height: auto;
}

.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-2 { margin-right: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pt-4 { padding-top: 1rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.border-2 { border-width: 2px; }
.border-t { border-top-width: 1px; }
.border-dashed { border-style: dashed; }
.border-gray-600 { border-color: rgb(75 85 99); }
.border-gray-700 { border-color: rgb(55 65 81); }
.bg-gray-700 { background-color: rgb(55 65 81); }
.bg-gray-800 { background-color: rgb(31 41 55); }
.bg-green-600 { background-color: rgb(22 163 74); }
.hover\:bg-green-700:hover { background-color: rgb(21 128 61); }
.cursor-pointer { cursor: pointer; }
.overflow-x-auto { overflow-x: auto; }
.max-h-48 { max-height: 12rem; }
.object-cover { object-fit: cover; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-md,
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-white { color: rgb(255 255 255); }
.text-gray-200 { color: rgb(229 231 235); }
.text-gray-300 { color: rgb(209 213 219); }
.text-gray-400 { color: rgb(156 163 175); }
.text-gray-500 { color: rgb(107 114 128); }
.text-blue-400 { color: rgb(96 165 250); }
.text-green-400 { color: rgb(74 222 128); }
.text-red-400 { color: rgb(248 113 113); }
.text-amber-400 { color: rgb(251 191 36); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); }

@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:col-span-3 { grid-column: span 3 / span 3; }
    .md\:col-span-4 { grid-column: span 4 / span 4; }
}

:root {
    --primary-color: #dc2626;
    --primary-light: #ef4444;
    --text-color: #e5e7eb;
    --bg-color: #111827;
    --card-bg: #1f2937;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

body {
    font-family: "Inter", sans-serif;
    background-color: #0b1220;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease-in-out;
    padding-bottom: 84px !important;
}

body.driver-auth-locked .container-app {
    visibility: hidden;
    pointer-events: none;
}

.container-app {
    max-width: 600px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    border-radius: 0.75rem;
    margin: 1rem auto;
    padding: 1rem;
    background: #162130 !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.25rem 1.25rem 1.75rem 1.25rem !important;
}

.driver-auth-gate {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at top, rgba(220, 38, 38, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.96), rgba(15, 23, 42, 0.98));
}

.driver-auth-card {
    width: min(100%, 420px);
    background: rgba(22, 33, 48, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    padding: 1.5rem;
}

.driver-auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.18);
    color: #fecaca;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.driver-auth-title {
    margin-top: 1rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: #f8fafc;
}

.driver-auth-copy {
    margin-top: 0.75rem;
    color: #cbd5e1;
    font-size: 0.95rem;
}

.driver-auth-status {
    margin-top: 0.9rem;
    color: #fca5a5;
    font-size: 0.9rem;
    min-height: 1.4rem;
}

.driver-auth-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.72);
}

.driver-auth-toolbar.hidden {
    display: none !important;
}

.driver-auth-toolbar-label {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.driver-auth-toolbar-user {
    color: #f8fafc;
    font-weight: 700;
}

.driver-auth-toolbar-meta {
    color: #cbd5e1;
    font-size: 0.82rem;
    margin-top: 0.15rem;
}

.driver-auth-toolbar .btn-secondary {
    width: auto;
    min-width: 96px;
}

@media (min-width: 640px) {
    .container-app {
        padding: 1.25rem;
        padding: 1.25rem 1.25rem 1.75rem 1.25rem !important;
    }
}

#page-title {
    font-size: 1.5rem !important;
    line-height: 2rem !important;
    font-weight: 800 !important;
    color: #e5e7eb !important;
    margin: 0 !important;
}

.tab-button {
    flex-grow: 1;
    padding: 0.5rem 0.5rem;
    font-weight: 600;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    transition: all 0.3s ease;
    color: var(--text-color);
    flex: 0 0 auto;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem !important;
    font-weight: 600 !important;
    color: #cbd5e1 !important;
    background: transparent !important;
    flex-grow: 0 !important;
}

.tab-button.active {
    background-color: var(--card-bg);
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: #dc2626 !important;
    color: #ffffff !important;
}

.tab-button:not(.active):hover {
    background: rgba(148, 163, 184, 0.08) !important;
}

.tabs-print-row {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    border: none !important;
    gap: 0.75rem;
    justify-content: flex-start !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    justify-content: space-around !important;
    background: #000 !important;
    border-top: 1px solid #2f2f2f !important;
    padding: 6px 8px !important;
}

.tabs-print-row::-webkit-scrollbar {
    display: none;
}

.tabs-print-row .tab-button {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: #a8a8a8 !important;
}

.tabs-print-row .tab-button.active {
    color: #fff !important;
}

.tabs-print-row .tab-button span {
    display: none !important;
}

input,
select,
textarea {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid #4b5563;
    box-shadow: var(--shadow);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
    border-radius: 0.65rem;
    box-shadow: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(31, 41, 55, 0.9);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.65);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.alert-box {
    background-color: rgba(31, 41, 55, 0.95);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    color: #e5e7eb;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-weight: 800;
    border-radius: 0.75rem;
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #374151;
    color: #e5e7eb;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    background: transparent !important;
    color: #cbd5e1 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    text-transform: none !important;
    font-size: 0.875rem !important;
}

.status-badge::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 9999px;
    background: #dc2626;
    display: inline-block;
}

.status-active {
    background-color: #10b981;
    color: white;
}

.status-active::before {
    background: #10b981;
}

.status-inactive {
    background-color: #6b7280;
    color: white;
    color: #cbd5e1 !important;
}

.status-active,
.status-inactive.status-active {
    color: #cbd5e1 !important;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 400px;
}

.required-field::after {
    content: " *";
    color: #ef4444;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.role-tab-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.role-tab-card {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
}

.role-tab-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(190, 24, 93, 0.18), rgba(15, 23, 42, 0.92));
}

.role-tab-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
}

.role-tab-head p {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    color: #cbd5e1;
}

.role-runtime-wrap {
    position: relative;
    min-height: 72vh;
    background: #020617;
}

.role-runtime-frame {
    display: block;
    width: 100%;
    height: 72vh;
    min-height: 720px;
    border: 0;
    background: #020617;
}

.role-runtime-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #cbd5e1;
    text-align: center;
    background:
        radial-gradient(circle at top, rgba(236, 72, 153, 0.14), transparent 36%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
}

.role-runtime-state.hidden {
    display: none;
}
