/* ============================================================
   4R TMS — COMPLETE THEME BASELINE (CLEAN VERSION)
   Replaces the legacy stylesheet entirely.
   ============================================================ */


/* ===== Layout frame (desktop) ===== */
.content-wrapper {
    max-width: none;
    margin: 20px 40px !important;
    padding: 16px 24px;
    background-color: #ffffff;
    border: 1px solid #c4c4c4;
    border-radius: 2px;
}

/* Global page typography / background */
body {
    background-color: #e4e4e4;
    color: #111;
    font-size: 14px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Breadcrumb spacing (for any pages still using it) */
.tms-breadcrumb-row {
    margin-top: 4px;
    margin-bottom: 8px;
}


/* ============================================================
   SORTABLE TABLE HEADERS
   ============================================================ */

.tms-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.tms-sortable::after {
    content: "";
    margin-left: 4px;
    font-size: 0.7em;
}

.tms-sortable.tms-sort-asc::after {
    content: "▲";
}

.tms-sortable.tms-sort-desc::after {
    content: "▼";
}


/* ============================================================
   FORMS — ENTERPRISE LAYOUT
   ============================================================ */

.tms-form-shell {
    margin-top: 8px;
}

.tms-form-panel {
    border: 1px solid #c4c4c4;
    background-color: #fafafa;
    padding: 16px 20px;
}

/* 2-column label / field grid */
.tms-form-grid {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
}

.tms-form-row-label {
    font-size: 0.85rem;
    color: #333;
    text-align: left;
    padding-right: 8px;
    white-space: nowrap;
}

.tms-form-row-field {
    width: 100%;
}

.tms-form-row-field input[type="text"],
.tms-form-row-field input[type="number"],
.tms-form-row-field input[type="date"],
.tms-form-row-field input[type="tel"],
.tms-form-row-field input[type="email"],
.tms-form-row-field select,
.tms-form-row-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid #b8b8b8;
    border-radius: 2px;
    font-size: 0.85rem;
}

/* Constrain standard field widths so they don't look like runways */
.tms-form-row-field input[type="text"],
.tms-form-row-field input[type="number"],
.tms-form-row-field input[type="tel"],
.tms-form-row-field input[type="email"],
.tms-form-row-field select {
    width: 380px;
    /* enterprise sweet spot */
    max-width: 100%;
    /* so it still works on narrow screens */
}

/* Dates and times a bit narrower */
.tms-form-row-field input[type="date"],
.tms-form-row-field input[type="time"] {
    width: 200px;
    max-width: 100%;
}

/* Notes / long text slightly wider but still controlled */
.tms-form-row-field textarea {
    width: 600px;
    max-width: 100%;
}

/* Multi-line notes / comments */
.tms-form-row-field textarea {
    min-height: 70px;
    resize: vertical;
}

/* Button row on forms (top or bottom) */
.tms-form-actions,
.form-actions.action-bar {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
    /* align left, like Create Load + Cancel */
    gap: 8px;
}

.tms-form-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Keep load form panels from stretching full screen */
.tms-load-form-page .tms-form-shell {
    max-width: 1100px;
    /* try 900–1100 based on taste */
}


/* ============================================================
   PAGE HEADER (TITLE + PRIMARY ACTION)
   Used on list pages (Loads / Customers / Drivers etc.)
   ============================================================ */

.tms-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Actions on the right side of page headers (Add / Trash, etc.) */
.tms-page-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* space between Add Load and Trash */
}

.tms-page-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* ============================================================
   NAVIGATION BAR (FULL ENTERPRISE STYLE)
   ============================================================ */

.tms-nav {
    background-color: #f3f3f3;
    border-bottom: 1px solid #c2c2c2;
    padding: 6px 24px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Flex wrapper that aligns left side and right side */
.tms-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Left navigation group */
.tms-nav-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Right navigation group */
.tms-nav-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Vertical separators */
.tms-nav-left>*+*,
.tms-nav-right>*+* {
    margin-left: 24px;
    position: relative;
}

.tms-nav-left>*+*::before,
.tms-nav-right>*+*::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background-color: #c2c2c2;
}

/* Nav links */
.tms-nav-link,
.tms-nav-link:visited {
    color: #222;
    text-decoration: none;
    font-weight: 500;
}

.tms-nav-link:hover {
    text-decoration: underline;
}

.tms-logo {
    font-weight: 700;
}


/* ============================================================
   DROPDOWN MENUS (LOAD MANAGER, CUSTOMERS, USER)
   ============================================================ */

.tms-nav-has-menu {
    position: relative;
}

/* Common menu styling */
.tms-nav-menu,
.tms-nav-user-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    border: 1px solid #c2c2c2;
    min-width: 180px;
    padding: 4px 0;
    display: none;
    z-index: 1000;
}

/* User menu aligns to the right of its trigger */
.tms-nav-user-menu {
    right: 0;
    left: auto;
}

/* Show menu when hovering the wrapper (trigger + menu together) */
.tms-nav-has-menu:hover .tms-nav-menu,
.tms-nav-user:hover .tms-nav-user-menu {
    display: block;
}

/* Items inside dropdowns */
.tms-nav-menu-link,
.tms-nav-user-menu .tms-nav-link {
    display: block;
    padding: 6px 12px;
    font-size: 0.8rem;
    text-transform: none;
    letter-spacing: normal;
    color: #222;
    text-decoration: none;
}

.tms-nav-menu-link:hover,
.tms-nav-user-menu .tms-nav-link:hover {
    background-color: #f1f1f1;
}


/* ============================================================
   TABLES (ENTERPRISE GRID)
   ============================================================ */

.tms-table {
    width: 100%;
    border-collapse: collapse;
}

/* Headers */
.tms-table thead th {
    background-color: #d6d6d6;
    border-bottom: 1px solid #b5b5b5;
    padding: 6px 8px;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Header links in sortable tables should look like headers, not blue links */
.tms-table thead th a,
.tms-table thead th a:visited {
    color: #111;
    text-decoration: none;
}

.tms-table thead th a:hover {
    text-decoration: underline;
}

/* Cells */
.tms-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #e1e1e1;
    font-size: 0.85rem;
}

/* Alternating rows */
.tms-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.tms-table tbody tr:nth-child(even) {
    background-color: #f7f7f7;
}

/* Hover */
.tms-table tbody tr:hover {
    background-color: #ececec;
}

/* Rows that behave like links */
.tms-table-row-clickable {
    cursor: pointer;
}

/* ============================================================
   BUTTONS — SYSTEM STYLE, ADMIN-SAFE
   ============================================================ */

/* Core neutral button
   Works for <button> and <a class="tms-btn">, including in Django admin
*/
.tms-btn,
.tms-btn:link,
.tms-btn:visited,
#content a.tms-btn,
#content a.tms-btn:link,
#content a.tms-btn:visited {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 400;
    padding: 3px 10px;
    border: 1px solid #777;
    background-color: #f2f2f2;
    color: #111;
    cursor: pointer;
    border-radius: 2px;
    text-decoration: none;
    line-height: 1.4;
}

/* Hover / active states */
.tms-btn:hover,
.tms-btn:active,
#content a.tms-btn:hover,
#content a.tms-btn:active {
    background-color: #e6e6e6;
    color: #111;
    text-decoration: none;
}

/* Slightly bolder text for header "Add" buttons (optional) */
.tms-btn-add {
    font-weight: 600;
}

/* Small buttons (Restore/Delete in trash, etc.) */
.tms-btn-sm {
    min-width: auto;
    /* keeps Restore / Delete same width */
    text-align: center;
    padding: 3px 10px;
    /* a bit tighter horizontally */
}

/* Link-style buttons (Cancel, Clear, etc.) */
.tms-btn-secondary,
.tms-btn-link,
.btn-link {
    background: none !important;
    border: none !important;
    padding: 3px 6px !important;
    color: #0645AD !important;
    text-decoration: underline;
    font-size: 0.85rem;
    cursor: pointer;
}

.tms-btn-secondary:hover,
.tms-btn-link:hover,
.btn-link:hover {
    text-decoration: none;
}

/* Delete: OS-gray chrome with red text */
.tms-btn-danger,
.tms-btn-danger:link,
.tms-btn-danger:visited,
#content a.tms-btn-danger,
#content a.tms-btn-danger:link,
#content a.tms-btn-danger:visited {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 400;
    padding: 3px 10px;
    border: 1px solid #777;
    background-color: #f2f2f2;
    color: #b22222;
    cursor: pointer;
    border-radius: 2px;
    text-decoration: none;
    line-height: 1.4;
}

.tms-btn-danger:hover,
.tms-btn-danger:active,
#content a.tms-btn-danger:hover,
#content a.tms-btn-danger:active {
    background-color: #e6e6e6;
    color: #951b1b;
    text-decoration: none;
}

/* Button groups (filters / action bars) */
.tms-filter-actions,
.tms-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
/* ============================================================
   FILTER / INPUT / BUTTON SPACING
   ============================================================ */

/* Horizontal spacing for filter inputs/dropdowns */
.content-wrapper input[type="text"],
.content-wrapper input[type="number"],
.content-wrapper input[type="date"],
.content-wrapper select {
    margin-right: 6px;
}

/* Row for Search / Clear / Delete: sits BELOW filter inputs */
.tms-filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 4px;
    width: 100%;
    clear: both;
}


/* ============================================================
   MOBILE / SMALL SCREENS
   ============================================================ */

@media (max-width: 900px) {

    .content-wrapper {
        margin: 10px 8px !important;
        padding: 12px;
        border-radius: 0;
    }

    .tms-nav {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .tms-nav-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .tms-nav-left,
    .tms-nav-right {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    /* Remove nav separators on mobile */
    .tms-nav-left>*::before,
    .tms-nav-right>*::before {
        content: none;
    }

    .tms-nav-link {
        padding: 0 2px;
    }

    /* Breadcrumb stack */
    .tms-breadcrumb-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Action bars */
    .tms-actions,
    .form-actions.action-bar,
    .tms-form-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    /* Filters collapse if wrapped in .tms-filter-row */
    .tms-filter-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .tms-filter-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    /* Table scroll */
    .tms-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tms-table {
        min-width: 700px;
    }

    .tms-table thead th,
    .tms-table tbody td {
        padding: 4px 6px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Forms collapse to single column */
    .tms-form-grid {
        grid-template-columns: 1fr;
    }

    .tms-form-row-label {
        text-align: left;
        margin-bottom: 2px;
    }
}
/* Force all tms-btn links to behave like buttons */
#content a.tms-btn,
#content a.tms-btn:link,
#content a.tms-btn:visited,
#content a.tms-btn:hover,
#content a.tms-btn:active {
    color: #111 !important;
    text-decoration: none !important;
    background-color: #f2f2f2 !important;
    border: 1px solid #777 !important;
    padding: 3px 10px !important;
    border-radius: 2px !important;
}
/* ===== Currency prefix input styling ===== */
.tms-input-with-prefix {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tms-prefix {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}
/* =========================================================
   AUTH / LOGIN LAYOUT – FLAT TMS STYLE
   ====================================================== */

html,
body.auth-body {
    height: 100%;
}

body.auth-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #0b1120;
    /* dark navy, not pure black */
    color: #111827;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Wrapper centers the card */
body.auth-body .auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 24px 16px;
    box-sizing: border-box;
}

/* Main card */
body.auth-body .auth-card {
    background: #f3f4f6;
    /* soft light grey, not pure white */
    border: 1px solid #1f2937;
    /* dark grey border */
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.45);
    padding: 24px 24px 20px 24px;
}

/* Header */
body.auth-body .auth-header {
    text-align: center;
    margin-bottom: 20px;
}

body.auth-body .auth-logo {
    display: block;
    margin: 0 auto 12px auto;
    max-width: 180px;
    height: auto;
}

body.auth-body .auth-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    margin: 0 0 4px 0;
    color: #4b5563;
}

/* Subtitle under logo: darker and readable */
body.auth-body .auth-subtitle {
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #374151;
    /* darker grey */
    font-weight: 600;
}

/* Messages */
body.auth-body .auth-messages {
    margin-bottom: 16px;
}

body.auth-body .auth-message {
    font-size: 0.9rem;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    margin-bottom: 6px;
}

body.auth-body .auth-message-error,
body.auth-body .auth-message-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

body.auth-body .auth-message-success {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

body.auth-body .auth-message-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

/* Form layout */
body.auth-body .auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Labels and fields */
body.auth-body .auth-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

body.auth-body .auth-label {
    font-weight: 500;
    color: #1f2937;
    /* dark, readable label text */
}

/* Inputs: OS-style light with clear border */
body.auth-body .auth-form-field input,
body.auth-body .auth-form-field select,
body.auth-body .auth-form-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #9ca3af;
    background: #ffffff;
    color: #111827;
    font-size: 0.9rem;
}

body.auth-body .auth-form-field input:focus,
body.auth-body .auth-form-field select:focus,
body.auth-body .auth-form-field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: none;
}

/* Error states */
body.auth-body .auth-nonfield-errors {
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.9rem;
}

body.auth-body .auth-error {
    margin: 0;
    font-size: 0.8rem;
    color: #b91c1c;
}

body.auth-body .auth-form-field.has-error input,
body.auth-body .auth-form-field.has-error select,
body.auth-body .auth-form-field.has-error textarea {
    border-color: #dc2626;
}

/* Submit button: solid, but not high-contrast white bar */
body.auth-body .auth-submit {
    margin-top: 10px;
    width: 100%;
    padding: 8px 10px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid #111827;
    background: #111827;
    color: #f9fafb;
    cursor: pointer;
}

body.auth-body .auth-submit:hover {
    background: #020617;
    border-color: #020617;
}

/* Footer */
body.auth-body .auth-footer-text {
    margin-top: 12px;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Responsive */
@media (min-width: 768px) {
    body.auth-body .auth-wrapper {
        max-width: 480px;
        padding: 32px 0;
    }

    body.auth-body .auth-card {
        padding: 28px 28px 22px 28px;
    }
}
/* Mobile tuning: raise login card a bit */
@media (max-width: 640px) {
    body.auth-body {
        align-items: flex-start;
    }

    body.auth-body .auth-wrapper {
        padding-top: 32px;
        /* adjust this number to move it higher/lower */
        padding-bottom: 16px;
    }
}
/* Prevent iOS Safari zoom on form fields */
@media (max-width: 640px) {

    body.auth-body .auth-form-field input,
    body.auth-body .auth-form-field select,
    body.auth-body .auth-form-field textarea {
        font-size: 16px;
    }
}