@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light;
    --bg-color: #bcc0c4;
    --panel-bg: #ffffff;
    --panel-border: #e2e8f0;
    --panel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --text: #334155;
    --muted: #64748b;
    --line: #cbd5e1;
    --primary: #4a7c59;      /* Tuero Mid-Dark Green */
    --primary-dark: #315949; /* Tuero Darkest Forest Green */
    --primary-light: #eaf2ec; /* Tuero Soft Green Tint */
    --danger: #ef4444;
    --ok: #4a7c59;
    --warn: #cbdb49;         /* Tuero Bright Yellow-Green */
}

* {
    box-sizing: border-box;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text);
    min-height: 100vh;
    overflow:hidden;
}

hr {
    border: none;
    height: 1px;
    background: var(--muted);
    box-shadow: 0px 0px 2px var(--muted);
    margin: 20px 0;
    grid-column: 1 / -1;
    width: 100%;
}

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

.shell {
    width: min(1600px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    box-shadow: var(--panel-shadow);
}

.brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tabs a, .button, button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #ffffff;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tabs a:hover, .button:hover, button:not(.primary):not(.danger):hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.button.primary, button.primary {
    border-color: transparent;
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.button.primary:hover, button.primary:hover {
    background: var(--primary-dark);
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 24px;
    box-shadow: var(--panel-shadow);
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

input, select, textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: #ffffff;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input[readonly], input[disabled], select[disabled] {
    background: #f8fafc;
    color: var(--muted);
    cursor: not-allowed;
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 10px 16px;
    border-radius: 4px;
    flex: 1;
    justify-content: center;
    font-weight: 600;
    color: var(--text);
}

.radio-btn input[type="radio"] {
    display: none;
}

.radio-btn:has(input[type="radio"]:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.gates label {
    font-size: 15px;
    color: var(--primary-dark);
}
.gates .radio-group {
    gap: 16px;
    margin-top: 4px;
}
.gates .radio-btn {
    padding: 16px;
    font-size: 18px;
    border-width: 2px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}
.gates .radio-btn:has(input[type="radio"]:checked) {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary-dark);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.checks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

.check input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
    cursor: pointer;
}

.notice, .error, .success {
    border-radius: 4px;
    padding: 14px 16px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
}

.notice {
    background: #fffbeb;
    color: #92400e;
    border-left-color: #f59e0b;
    border-top: 1px solid #fde68a;
    border-right: 1px solid #fde68a;
    border-bottom: 1px solid #fde68a;
}

.error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: #ef4444;
    border-top: 1px solid #fecaca;
    border-right: 1px solid #fecaca;
    border-bottom: 1px solid #fecaca;
}

.success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #10b981;
    border-top: 1px solid #bbf7d0;
    border-right: 1px solid #bbf7d0;
    border-bottom: 1px solid #bbf7d0;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.rules {
    max-height: none;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 12px;
    background: #f8fafc;
    line-height: 1.45;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

/* Consultas / Queue styles */
.consultas-header {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--line);
    padding-bottom: 12px;
}

.consultas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.consulta-card {
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--panel-shadow);
}

.consulta-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.consulta-card h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
}

.consulta-card p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 4px;
    border: 1px solid var(--line);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #f1f5f9;
}

/* Queue Screen */
.queue {
    background: #e2e8f0;
    color: var(--text);
    min-height: 100vh;
}
.queue .shell {
    width: min(1600px, calc(100% - 48px));
}
.queue h1 {
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--primary-dark);
}
.queue-table {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.queue-table th, .queue-table td {
    border-bottom: 1px solid var(--line);
    padding: 20px;
    font-size: 24px;
}
.queue-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 16px;
    border-bottom: 2px solid var(--line);
}
.turn {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-block;
}

/* Responsive Table Overrides for forms inside tables */
.table-responsive input, .table-responsive select {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    width: 100%;
}

.table-responsive input[name="vehicle_plate"] {
    width: 110px;
    text-align: center;
    text-transform: uppercase;
}

.table-responsive input[name="turn_number"] {
    width: 70px;
    text-align: center;
}

.datetime-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

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

.table-responsive button.primary, .table-responsive button.danger {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.table-responsive button.danger {
    background: var(--danger);
    color: white;
    border-color: transparent;
}

.table-responsive button.danger:hover {
    background: #b91c1c;
}

/* Make text cells tight */
.dni-cell { font-family: monospace; font-size: 13px; }
.name-cell, .company-cell { font-weight: 500; min-width: 120px; }

@media (max-width: 768px) {
    .grid { grid-template-columns: 1fr; }
    .panel { padding: 20px; }
    .topbar { flex-direction: column; align-items: stretch; }
    .tabs { justify-content: stretch; }
    .tabs a { flex: 1; text-align: center; }
    .shell { padding: 16px; }
}
