/* ── FEAT-221 — Shared table kit: pagination + export standard ───────────── */

/* ── Pagination control row ──────────────────────────────────────────────── */

.tk-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Per-page dropdown */
.tk-per-page-select {
    min-width: 110px;
    font-size: 13px;
}

/* Prev / Next nav buttons — 44px touch target */
.tk-btn.tk-btn-nav {
    min-height: 44px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 5px;
    border: 1px solid #2a2f45;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.tk-btn.tk-btn-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* "Showing X–Y of Z" counter */
.tk-info {
    font-size: 13px;
    white-space: nowrap;
    padding: 0 4px;
}

/* ── Dark theme ─────────────────────────────────────────────────────────── */

body[data-theme="dark"] .tk-btn.tk-btn-nav,
:not(body[data-theme="light"]) .tk-btn.tk-btn-nav {
    background: #252b3b;
    color: #e8eaf0;
    border-color: #2d3548;
}

body[data-theme="dark"] .tk-btn.tk-btn-nav:hover:not(:disabled),
:not(body[data-theme="light"]) .tk-btn.tk-btn-nav:hover:not(:disabled) {
    background: #2d3548;
}

body[data-theme="dark"] .tk-info,
:not(body[data-theme="light"]) .tk-info {
    color: #9aa3b5;
}

/* ── Light theme ─────────────────────────────────────────────────────────── */

body[data-theme="light"] .tk-btn.tk-btn-nav {
    background: #f0f2f8;
    color: #1a1a2e;
    border-color: #c8cee0;
}

body[data-theme="light"] .tk-btn.tk-btn-nav:hover:not(:disabled) {
    background: #e0e4f0;
}

body[data-theme="light"] .tk-info {
    color: #4a5568;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 390px) {
    .tk-pagination {
        gap: 8px;
    }

    .tk-btn.tk-btn-nav {
        flex: 1;
        justify-content: center;
    }

    .tk-info {
        width: 100%;
        text-align: center;
        order: -1;
    }
}

/* ── Export toolbar ──────────────────────────────────────────────────────── */

.tk-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

.tk-btn-export {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 5px;
    border: 1px solid #2a2f45;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

body[data-theme="dark"] .tk-btn-export,
:not(body[data-theme="light"]) .tk-btn-export {
    background: #252b3b;
    color: #e8eaf0;
    border-color: #2d3548;
}

body[data-theme="dark"] .tk-btn-export:hover,
:not(body[data-theme="light"]) .tk-btn-export:hover {
    background: #2d3548;
}

body[data-theme="light"] .tk-btn-export {
    background: #f0f2f8;
    color: #1a1a2e;
    border-color: #c8cee0;
}

body[data-theme="light"] .tk-btn-export:hover {
    background: #e0e4f0;
}

/* ── Table shell ─────────────────────────────────────────────────────────── */

.tk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

body[data-theme="dark"] .tk-table th,
:not(body[data-theme="light"]) .tk-table th {
    background: #1e2537;
    color: #e8eaf0;
    border: 1px solid #2d3548;
    padding: 8px 10px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
}

body[data-theme="dark"] .tk-table td,
:not(body[data-theme="light"]) .tk-table td {
    background: #252b3b;
    color: #e8eaf0;
    border: 1px solid #2d3548;
    padding: 7px 10px;
    text-align: left;
}

body[data-theme="dark"] .tk-table tr:hover td,
:not(body[data-theme="light"]) .tk-table tr:hover td {
    background: #2d3548;
}

body[data-theme="light"] .tk-table th {
    background: #eef1f8;
    color: #1a1a2e;
    border: 1px solid #c8cee0;
    padding: 8px 10px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
}

body[data-theme="light"] .tk-table td {
    background: #ffffff;
    color: #1a1a2e;
    border: 1px solid #c8cee0;
    padding: 7px 10px;
    text-align: left;
}

body[data-theme="light"] .tk-table tr:hover td {
    background: #f5f7fd;
}

@media (max-width: 390px) {
    .tk-toolbar {
        justify-content: flex-start;
    }

    .tk-btn-export {
        flex: 1;
        text-align: center;
    }
}

/* ── FEAT-280 — tk-drill: expandable row kit ─────────────────────────────── */

.tk-drill-chevron-cell {
    width: 32px;
    padding: 4px 6px !important;
    text-align: center;
}

.tk-drill-header-cell { width: 32px; }

.tk-drill-chevron {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 3px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.tk-drill-chevron:focus-visible {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

body[data-theme="dark"] .tk-drill-chevron,
:not(body[data-theme="light"]) .tk-drill-chevron {
    color: #9aa3b5;
}

body[data-theme="dark"] .tk-drill-chevron:hover,
:not(body[data-theme="light"]) .tk-drill-chevron:hover {
    color: #c8d0e0;
    background: rgba(255,255,255,0.05);
}

body[data-theme="dark"] .tk-drill-chevron--open,
:not(body[data-theme="light"]) .tk-drill-chevron--open { color: #4a90d9; }

body[data-theme="light"] .tk-drill-chevron { color: #6b7280; }
body[data-theme="light"] .tk-drill-chevron:hover { color: #1a1f2e; background: rgba(0,0,0,0.04); }
body[data-theme="light"] .tk-drill-chevron--open { color: #1a6ab5; }

/* Detail row — suppresses the default td background + hover */
.tk-drill-detail-row td {
    padding: 0 !important;
    border-top: none !important;
}

body[data-theme="dark"] .tk-drill-detail-row td,
:not(body[data-theme="light"]) .tk-drill-detail-row td {
    background: #1a1f30 !important;
}

body[data-theme="dark"] .tk-drill-detail-row:hover td,
:not(body[data-theme="light"]) .tk-drill-detail-row:hover td {
    background: #1a1f30 !important;
}

body[data-theme="light"] .tk-drill-detail-row td,
body[data-theme="light"] .tk-drill-detail-row:hover td {
    background: #eef1f8 !important;
}

/* Panel outer shell */
.tk-drill-panel {
    padding: 16px 20px;
    border-left: 3px solid #2d3548;
}

body[data-theme="light"] .tk-drill-panel { border-left-color: #c8cee0; }

/* Error + loading + empty states — fails loud, never a silent blank */
.tk-drill-error {
    border-left: 3px solid #dc3545;
    border-radius: 3px;
    padding: 8px 12px;
    font-size: 13px;
}

body[data-theme="dark"] .tk-drill-error,
:not(body[data-theme="light"]) .tk-drill-error {
    color: #f8d7da;
    background: #3b1a1a;
}

body[data-theme="light"] .tk-drill-error {
    color: #721c24;
    background: #fff5f5;
}

.tk-drill-loading { font-size: 13px; font-style: italic; }
.tk-drill-empty   { font-size: 13px; font-style: italic; }

body[data-theme="dark"] .tk-drill-loading,
body[data-theme="dark"] .tk-drill-empty,
:not(body[data-theme="light"]) .tk-drill-loading,
:not(body[data-theme="light"]) .tk-drill-empty { color: #9aa3b5; }

body[data-theme="light"] .tk-drill-loading,
body[data-theme="light"] .tk-drill-empty { color: #6b7280; }

/* Panel inner layout */
.tk-drill-panel-inner { display: flex; flex-direction: column; gap: 16px; }

/* Section */
.tk-drill-section { display: flex; flex-direction: column; gap: 8px; }

.tk-drill-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 6px;
}

body[data-theme="dark"] .tk-drill-section-title,
:not(body[data-theme="light"]) .tk-drill-section-title { color: #9aa3b5; }

body[data-theme="light"] .tk-drill-section-title { color: #5a6376; }

.tk-drill-meta-note { font-weight: 400; font-size: 11px; }

body[data-theme="dark"] .tk-drill-meta-note,
:not(body[data-theme="light"]) .tk-drill-meta-note { color: #6b7280; }

body[data-theme="light"] .tk-drill-meta-note { color: #9aa3b5; }

/* Rejection block */
.tk-drill-section--rejection .tk-drill-section-title { color: #dc3545 !important; }

body[data-theme="light"] .tk-drill-section--rejection .tk-drill-section-title {
    color: #c0392b !important;
}

.tk-drill-rejection-list {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tk-drill-rejection-list li { font-size: 13px; line-height: 1.5; }

body[data-theme="dark"] .tk-drill-rejection-list li,
:not(body[data-theme="light"]) .tk-drill-rejection-list li { color: #f8d7da; }

body[data-theme="light"] .tk-drill-rejection-list li { color: #721c24; }

/* Definition list (application metadata, payment fields) */
.tk-drill-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 16px;
    margin: 0;
    font-size: 13px;
}

.tk-drill-dl dt { white-space: nowrap; }

body[data-theme="dark"] .tk-drill-dl dt,
:not(body[data-theme="light"]) .tk-drill-dl dt { color: #9aa3b5; }

body[data-theme="light"] .tk-drill-dl dt { color: #5a6376; }

.tk-drill-dl dd { margin: 0; }

body[data-theme="dark"] .tk-drill-dl dd,
:not(body[data-theme="light"]) .tk-drill-dl dd { color: #e8eaf0; }

body[data-theme="light"] .tk-drill-dl dd { color: #1a1f2e; }

/* Vehicle cards */
.tk-drill-veh-list { display: flex; flex-direction: column; gap: 10px; }

.tk-drill-veh-card {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #2d3548;
    font-size: 13px;
}

body[data-theme="dark"] .tk-drill-veh-card,
:not(body[data-theme="light"]) .tk-drill-veh-card {
    background: rgba(255,255,255,0.03);
}

body[data-theme="light"] .tk-drill-veh-card {
    background: rgba(0,0,0,0.03);
    border-color: #d0d5e0;
}

.tk-drill-veh-field { white-space: nowrap; font-size: 13px; }

body[data-theme="dark"] .tk-drill-veh-field,
:not(body[data-theme="light"]) .tk-drill-veh-field { color: #e8eaf0; }

body[data-theme="light"] .tk-drill-veh-field { color: #1a1f2e; }

.tk-drill-field-label {
    font-size: 11px;
    font-weight: 600;
    margin-right: 2px;
}

body[data-theme="dark"] .tk-drill-field-label,
:not(body[data-theme="light"]) .tk-drill-field-label { color: #9aa3b5; }

body[data-theme="light"] .tk-drill-field-label { color: #5a6376; }

/* Payment */
.tk-drill-pay-card { font-size: 13px; }
.tk-drill-fee-block { margin-top: 8px; }
.tk-drill-fee-list { margin: 4px 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tk-drill-fee-list li { font-size: 13px; }

body[data-theme="dark"] .tk-drill-fee-list li,
:not(body[data-theme="light"]) .tk-drill-fee-list li { color: #e8eaf0; }

body[data-theme="light"] .tk-drill-fee-list li { color: #1a1f2e; }

/* 390px — stack so nothing scrolls sideways */
@media (max-width: 430px) {
    .tk-drill-panel { padding: 12px; }

    .tk-drill-veh-card {
        flex-direction: column;
        gap: 4px;
    }

    .tk-drill-veh-field { white-space: normal; }

    .tk-drill-dl {
        grid-template-columns: 1fr;
    }

    .tk-drill-dl dt {
        font-weight: 600;
        margin-top: 4px;
    }

    .tk-drill-dl dt:first-child { margin-top: 0; }

    .tk-drill-dl dd { margin-left: 8px; }
}
