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

* {
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif !important;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif !important;
    background: #f4f5f7;
    color: #202020;
}

/* Override Bootstrap fonts globally */
html, body, div, p, span, h1, h2, h3, h4, h5, h6, 
a, button, input, select, textarea, label, form, table, 
ul, ol, li, thead, tbody, th, td {
    font-family: 'Roboto', sans-serif !important;
}

.topbar {
    background: #2b2b2b;
    color: white;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-shrink: 0;
}

.nav-center {
    display: flex;
    gap: 18px;
    flex: 1;
    justify-content: center;
    align-items: center;
}

.nav-right {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-shrink: 0;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 700;
}

.brand img {
    width: 90px;
    height: auto;
    background: white;
    border-radius: 6px;
    padding: 4px;
}

.brand-title {
    font-size: 24px;
    font-weight: 800;
}

.brand-subtitle {
    font-size: 13px;
    color: #ddd;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    border-left: 1px solid #555;
}

.username {
    font-weight: 600;
    color: #ddd;
}

.role-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.logout-link {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.logout-link:hover {
    background: rgba(255, 107, 107, 0.1);
}

.container {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 20px;
}

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

.page-header h1,
h1 {
    margin-bottom: 4px;
}

.page-header p {
    margin-top: 0;
    color: #666;
}

.primary-button,
.secondary-button,
.small-button,
button {
    display: inline-block;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.primary-button,
button {
    background: #ed1c24;
    color: white;
    padding: 11px 16px;
}

.secondary-button {
    background: #e9e9e9;
    color: #222;
    padding: 11px 16px;
}

.small-button {
    background: #2b2b2b;
    color: white;
    padding: 7px 11px;
}

.danger-button {
    background: #6f1d1b;
}

.billed-toggle {
    background: #c0c0c0;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 7px 11px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.billed-toggle:hover {
    background: #a8a8a8;
}

.billed-toggle.billed-active {
    background: #22c55e;
}

.billed-toggle.billed-active:hover {
    background: #16a34a;
}

.filter-card,
.form-card,
.details-card {
    background: white;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.filter-card {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #d2d2d2;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Roboto', sans-serif;
}

textarea {
    min-height: 110px;
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    font-size: 13px;
    table-layout: fixed;
}

.jobs-table th {
    background: #2b2b2b;
    color: white;
    text-align: left;
    padding: 8px 10px;
}

.jobs-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    overflow-wrap: break-word;
}

/* Job scope notes: wrap to at most 2 lines, full text via the cell's title tooltip.
   The clamp lives on an inner div because table cells don't honour -webkit-box. */
.jobs-table td.job-notes > div {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    max-height: 2.7em;
}

.jobs-table td.job-notes {
    color: #555;
}

/* Job name stays on one line: a code like "T-125468" is unreadable split across
   two. Overriding the inherited break-word, since nowrap alone won't stop it. */
.jobs-table td.job-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: keep-all;
}

/* Column widths. table-layout: fixed would otherwise split all columns evenly,
   starving Address/Notes to pad out Date/PDF/Billed. Percentages total 100%.
   Columns in order: Date, Job Name, Client, Address, Notes, Status, PDF, Billed,
   [Billed Amount, admin only], Open */
.jobs-table th:nth-child(1), .jobs-table td:nth-child(1) { width: 8%; }    /* Date */
.jobs-table th:nth-child(2), .jobs-table td:nth-child(2) { width: 13%; }   /* Job Name */
.jobs-table th:nth-child(3), .jobs-table td:nth-child(3) { width: 13%; }   /* Client */
.jobs-table th:nth-child(4), .jobs-table td:nth-child(4) { width: 18%; }   /* Address */
.jobs-table th:nth-child(5), .jobs-table td:nth-child(5) { width: 22%; }   /* Notes */
.jobs-table th:nth-child(6), .jobs-table td:nth-child(6) { width: 9%; }    /* Status */
.jobs-table th:nth-child(7), .jobs-table td:nth-child(7) { width: 4%; }    /* PDF */
.jobs-table th:nth-child(8), .jobs-table td:nth-child(8) { width: 5%; }    /* Billed */
/* Billed Amount is admin-only and is now the last column when present. */
.jobs-table th:nth-child(9), .jobs-table td:nth-child(9) { width: 8%; }    /* Billed Amount */

/* Date stays on one line: "27/05/2026" split across two rows is hard to scan. */
.jobs-table td:nth-child(1) {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: keep-all;
}

/* Rows are clickable: whole row opens the job (see Index.cshtml).
   On hover the row lifts: grey background, drop shadow and a slight scale.
   A <tr> only honours transform once it has its own transform context, hence
   the base transform/scale(1) rather than transforming on :hover alone. */
.jobs-table tbody tr.job-row {
    cursor: pointer;
    position: relative;
    transform: scale(1);
    transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

.jobs-table tbody tr.job-row:hover {
    background-color: #ededed;
    transform: scale(1.01);
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
    /* Lift above neighbouring rows so the shadow is not clipped by them. */
    position: relative;
    z-index: 2;
}

.jobs-table tbody tr.job-row:focus-visible {
    outline: 2px solid #2b2b2b;
    outline-offset: -2px;
    background-color: #ededed;
    transform: scale(1.01);
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
    z-index: 2;
}

/* Respect a reduced-motion preference: keep the highlight, drop the movement. */
@media (prefers-reduced-motion: reduce) {
    .jobs-table tbody tr.job-row,
    .jobs-table tbody tr.job-row:hover,
    .jobs-table tbody tr.job-row:focus-visible {
        transform: none;
        transition: background-color 0.14s ease;
    }
}

/* The billing controls sit inside a clickable row but handle their own clicks,
   so give them a normal cursor to signal they are not part of the row link. */
.jobs-table .billed-toggle,
.jobs-table .edit-icon,
.jobs-table .billed-amount-input {
    cursor: pointer;
}

.jobs-table .billed-amount-input {
    cursor: text;
}

/* Scale the in-row controls to match the 13px rows. Scoped to .jobs-table so the
   same components keep their normal size everywhere else. */
.jobs-table .status-pill {
    padding: 3px 9px;
    font-size: 11px;
    white-space: nowrap;
}

.jobs-table .billed-toggle {
    padding: 3px 8px;
    font-size: 13px;
}

.jobs-table .small-button {
    padding: 4px 9px;
    font-size: 12px;
}

.jobs-table .billing-display {
    min-width: 56px;
    font-size: 12px;
}

/* The amount and its edit pencil share one flex cell; keep them from colliding
   with each other or crowding the Open button in the next column. */
.jobs-table .billing-amount-cell {
    gap: 4px;
    flex-wrap: nowrap;
    padding-right: 6px;
}

.jobs-table .edit-icon {
    padding: 2px;
    flex: 0 0 auto;
}

.jobs-table .edit-icon svg {
    width: 13px;
    height: 13px;
}

.jobs-table .billed-amount-input {
    width: 72px;
    font-size: 12px;
    padding: 3px 5px;
}

.job-name {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 600;
}

.yes {
    color: #137333;
    font-weight: 800;
}

.no {
    color: #999;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    font-weight: 800;
    display: grid;
    gap: 7px;
}

.wide {
    grid-column: 1 / -1;
}

.actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* Two independent columns that each pack their own cards tight.

   This deliberately is NOT a two-column grid. In a grid the columns share
   rows, so a card cannot start until the tallest card of the row above has
   finished: the short Job Details card (390px) would sit above a ~400px hole
   while it waited for the tall Draft PDF card (786px) beside it.

   Each column is its own vertical flex stack instead, so a card sits directly
   below its own previous card and never waits for the other column. The two
   wrapper elements are .details-col-left and .details-col-right in the markup. */
.details-grid {
    display: grid;
    grid-template-columns: 3fr 7fr;
    gap: 18px;
    align-items: start;
}

.details-col-left,
.details-col-right {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.details-grid .details-card {
    padding: 14px;
    /* Matches the 13px of .jobs-table so the two pages read at one size. */
    font-size: 13px;
    /* Grid items default to min-width: auto, so one unbreakable string sets the
       column's floor. The draft PDF filename is ~90 characters with no spaces,
       which on a phone pushed the column to 776px inside a 390px screen and
       made the whole page scroll sideways. */
    min-width: 0;
}

/* Headings and controls scaled to the 13px body, since both would otherwise
   keep their browser defaults and tower over the text beside them. */
.details-grid .details-card h2 {
    font-size: 17px;
}

.details-grid .details-card h3 {
    font-size: 14px;
}

.details-grid .details-card input,
.details-grid .details-card select,
.details-grid .details-card textarea,
.details-grid .details-card button {
    font-size: 13px;
}

/* Long filenames, share links and addresses wrap instead of widening the card. */
.details-grid .details-card p,
.details-grid .details-card dd,
.details-grid .details-card h2 {
    overflow-wrap: anywhere;
}

/* Update Job sits in the 30% column now, so its two side-by-side halves
   (edit form | add-note form) stack instead. */
.details-col-left .update-job-layout {
    grid-template-columns: 1fr;
    gap: 14px;
}

dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: start;
}

dt {
    font-weight: 800;
    margin-top: 10px;
    max-width: none;
    white-space: nowrap;
}

dt:first-child {
    margin-top: 0;
}

dd {
    margin-left: 0;
    margin-top: 2px;
    margin-bottom: 0;
    color: #444;
}

.mini-form {
    margin-top: 15px;
    display: grid;
    gap: 10px;
}

.checklist-preview {
    margin-top: 24px;
    border-top: 1px solid #eee;
    padding-top: 18px;
}

.icon-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.icon-row div {
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    font-weight: 800;
    background: #fafafa;
}

.icon-row img {
    height: 42px;
    display: block;
    margin: 0 auto 8px;
}

.status-pill {
    display: inline-block;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Status color gradient from red through orange to green */
.status-pill.status-new {
    background: #f44336; /* Red */
}

.status-pill.status-drafting {
    background: #ff9800; /* Orange */
}

.status-pill.status-sent-to-office {
    background: #ffc107; /* Amber/Yellow */
    color: #333; /* Dark text for light background */
}

.status-pill.status-sent-to-customer {
    background: #ffeb3b; /* Light Yellow */
    color: #333; /* Dark text for light background */
}

.status-pill.status-changes-needed {
    background: #ff5722; /* Deep Orange/Red */
}

.status-pill.status-changes-submitted {
    background: #800000; /* Maroon */
}

.status-pill.status-approved {
    background: #8bc34a; /* Light Green */
}

.status-pill.status-to-print {
    background: #9e9e9e; /* Grey */
    color: white;
}

.status-pill.status-complete {
    background: #9c27b0; /* Purple */
    color: white;
}

.status-timestamp {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    font-style: italic;
}

/* PDF Preview Styles */
.pdf-preview-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 400px;
}

.pdf-viewer {
    width: 100%;
    min-height: 500px;
    border: none;
    display: block;
}

.pdf-viewer p {
    margin: 20px;
    text-align: center;
    color: #666;
}

/* Update Job Layout with Notes Sidebar */
.update-job-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.update-form {
    display: grid;
    gap: 12px;
}

.notes-form {
    display: grid;
    gap: 12px;
}

.notes-sidebar {
    grid-column: 1 / -1;
    border-top: 1px solid #eee;
    padding-top: 18px;
    margin-top: 0;
}

.notes-sidebar h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #202020;
}

.note-item {
    background: #f9f9f9;
    border-left: 4px solid #2b2b2b;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.note-content {
    margin: 0 0 4px 0;
    color: #202020;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.note-author {
    display: block;
    font-size: 11px;
    color: #555;
    font-weight: 600;
    margin-bottom: 2px;
}

.note-date {
    display: block;
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.note-edit-btn,
.note-delete-btn {
    background: none;
    border: 1px solid #ddd;
    color: #333;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: 'Roboto', sans-serif;
}

.note-edit-btn:hover {
    background: #e8f4f8;
    border-color: #0069d9;
    color: #0069d9;
}

.note-delete-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.note-delete-btn:hover {
    background: #ffe5e8;
    border-color: #bb2d3b;
    color: #bb2d3b;
}

/* ==================== ADMIN PANEL STYLES ==================== */

.admin-container {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 20px;
}

.admin-header {
    margin-bottom: 28px;
}

.admin-header h1 {
    font-size: 32px;
    margin: 0 0 8px 0;
    color: #202020;
}

.admin-header .subtitle {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.admin-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 28px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.panel-header {
    border-bottom: 2px solid #ed1c24;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.panel-header h2 {
    margin: 0;
    font-size: 20px;
    color: #202020;
}

.admin-form {
    display: grid;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #202020;
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #ed1c24;
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: flex-end;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    margin-left: 6px;
    gap: 6px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn {
    display: inline-block;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: #ed1c24;
    color: white;
}

.btn-primary:hover {
    background: #d41920;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(237, 28, 36, 0.2);
}

.btn-secondary {
    background: #e9e9e9;
    color: #202020;
}

.btn-secondary:hover {
    background: #d9d9d9;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.users-table-responsive {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #ed1c24;
}

.users-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #202020;
}

.users-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.user-row:hover {
    background: #f8f9fa;
}

.users-table .username {
    font-weight: 600;
    color: #202020;
}

.users-table .email {
    color: #666;
    font-size: 13px;
}

.users-table .date-small {
    color: #999;
    font-size: 13px;
}

.role-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.role-badge.role-admin {
    background: #667eea;
    color: white;
}

.role-badge.role-manager {
    background: #f093fb;
    color: white;
}

.role-badge.role-viewer {
    background: #4ecdc4;
    color: white;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

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

.btn-action {
    background: none;
    border: none;
    padding: 6px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-action:hover {
    background: #f0f0f0;
}

.btn-action.edit-btn:hover {
    background: #e3f2fd;
}

.btn-action.reset-btn:hover {
    background: #fff3e0;
}

.btn-action.delete-btn:hover {
    background: #ffebee;
}

.modal-header {
    border-bottom: 1px solid #ed1c24;
    background: #f8f9fa;
}

.modal-header .modal-title {
    font-weight: 600;
    color: #202020;
}

.modal-body {
    padding: 20px;
}

.modal-body .mb-3 {
    margin-bottom: 16px;
}

.form-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #202020;
    font-size: 14px;
}

.form-control {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.form-control:focus {
    border-color: #ed1c24;
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
    outline: none;
}

.form-control:disabled {
    background: #f0f0f0;
    color: #999;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert .btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.alert .btn-close:hover {
    opacity: 1;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 28px;
    font-style: italic;
}

@media (max-width: 800px) {
    .topbar,
    .page-header,
    .filter-card {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid,
    .details-grid,
    .icon-row,
    .update-job-layout {
        grid-template-columns: 1fr;
    }

    /* One column on a phone: the two stacks sit one after the other, left
       first, which keeps the job's details and its controls above the PDF. */
    .details-col-left,
    .details-col-right {
        gap: 18px;
    }

    /* iOS zooms the viewport when a focused field is under 16px, so the inputs
       go back up on a phone even though the surrounding text stays at 13px. */
    .details-grid .details-card input,
    .details-grid .details-card select,
    .details-grid .details-card textarea {
        font-size: 16px;
    }

    .notes-sidebar {
        grid-column: 1;
    }

    .pdf-viewer {
        min-height: 300px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .users-table {
        font-size: 12px;
    }

    .users-table th,
    .users-table td {
        padding: 8px;
    }
}

/* Approval Page Styling */
.approval-page-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    font-family: 'Roboto', sans-serif !important;
}

.approval-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 40px;
    font-family: 'Roboto', sans-serif !important;
}

.approval-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 3px solid #ed1c24;
    padding-bottom: 20px;
}

.approval-header h1 {
    color: #333;
    font-weight: 700;
    margin: 0;
    font-size: 28px;
    font-family: 'Roboto', sans-serif !important;
}

.approval-header p {
    color: #666;
    margin: 10px 0 0 0;
    font-size: 14px;
    font-family: 'Roboto', sans-serif !important;
}

.job-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #ed1c24;
    font-family: 'Roboto', sans-serif !important;
}

.job-details strong {
    color: #2b2b2b;
    display: inline-block;
    min-width: 140px;
}

.checklist-title {
    margin-bottom: 25px;
    color: #2b2b2b;
    font-weight: 600;
    font-size: 16px;
}

.approver-info-section {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 5px solid #ed1c24;
}

.approver-info-section label {
    font-weight: 600;
    color: #2b2b2b;
    margin-bottom: 10px;
    display: block;
    font-size: 15px;
}

.approver-info-section input.form-control {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
}

.approver-info-section input.form-control:focus {
    border-color: #ed1c24;
    outline: none;
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    border-left: 5px solid #ed1c24;
    transition: all 0.2s ease;
    gap: 20px;
    font-family: 'Roboto', sans-serif !important;
}

.checklist-item:hover {
    background-color: #efefef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.checkbox-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-top: 8px;
    position: relative;
}

.approval-checkbox {
    width: 64px;
    height: 64px;
    cursor: pointer;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.approval-checkbox:hover {
    background: #e8e8e8;
    border-color: #bbb;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(237, 28, 36, 0.3);
}

.approval-checkbox:checked {
    background: #d4edda;
    border-color: #28a745;
    box-shadow: 0 0 12px rgba(40, 167, 69, 0.5);
}

.approval-checkbox:checked::after {
    content: '✓';
    color: #28a745;
    font-size: 40px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox-label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    color: #333;
    font-family: 'Roboto', sans-serif !important;
}

.checkbox-label strong {
    display: block;
    color: #2b2b2b;
    margin-bottom: 8px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif !important;
}

.checkbox-label span {
    display: block;
    color: #555;
    font-size: 14px;
    margin-bottom: 8px;
    font-family: 'Roboto', sans-serif !important;
}

.checkbox-label ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    font-size: 14px;
    color: #555;
    font-family: 'Roboto', sans-serif !important;
}

.checkbox-label ul li {
    margin-bottom: 5px;
    line-height: 1.4;
    font-family: 'Roboto', sans-serif !important;
}

.changes-section {
    margin-bottom: 30px;
}

.changes-section label {
    font-weight: 600;
    color: #2b2b2b;
    margin-bottom: 10px;
    display: block;
    font-size: 15px;
    font-family: 'Roboto', sans-serif !important;
}

.changes-section textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: #333;
    resize: vertical;
}

.changes-section textarea:focus {
    border-color: #ed1c24;
    outline: none;
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
}

.btn-approve {
    background: #ed1c24;
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-approve:hover {
    background: #c91814;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(237, 28, 36, 0.3);
}

.btn-approve:active {
    transform: translateY(0);
}

.pdf-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.pdf-link {
    display: inline-block;
    background: #ed1c24;
    color: white;
    padding: 10px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.pdf-link:hover {
    background: #c91814;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(237, 28, 36, 0.2);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success strong {
    color: #0c5460;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.progress-bar {
    background: linear-gradient(90deg, #ed1c24 0%, #c91814 100%);
}

@media (max-width: 768px) {
    .approval-card {
        padding: 25px;
    }

    .approval-header h1 {
        font-size: 22px;
    }

    .approval-page-container {
        margin: 20px auto;
        padding: 10px;
    }

    .checklist-item {
        padding: 15px;
    }

    .btn-approve {
        padding: 12px 30px;
        font-size: 15px;
    }
}

/* ==================== REFINED COMPACT LAYOUT ==================== */

/* Compact details grid for job overview */
.job-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.overview-item {
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    font-size: 13px;
    transition: all 0.2s ease;
}

.overview-item:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.overview-item-label {
    font-weight: 700;
    color: #666;
    margin-bottom: 4px;
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.overview-item-value {
    color: #222;
    word-break: break-word;
    font-weight: 500;
}

.overview-item-value .status-pill {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
}

/* Side-by-side grid for PDF and Documents sections */
.deliverables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .deliverables-grid {
        grid-template-columns: 1fr;
    }
}

/* Compact document upload form - inline */
.doc-upload-compact {
    background: linear-gradient(to bottom, #f9f9f9, #f5f5f5);
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    border: 1px solid #ddd;
}

.doc-upload-compact-row {
    display: grid;
    grid-template-columns: 1fr 1fr 120px 80px;
    gap: 8px;
    align-items: flex-end;
}

.doc-upload-compact-row input {
    padding: 8px;
    font-size: 12px;
}

.doc-upload-compact-row button {
    padding: 8px 12px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .doc-upload-compact-row {
        grid-template-columns: 1fr;
    }
    
    .doc-upload-compact-row button {
        width: 100%;
    }
}

/* Improved document table */
.document-table-wrapper {
    overflow-x: auto;
    margin-bottom: 12px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.document-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.document-table thead {
    background: linear-gradient(to right, #f5f5f5, #efefef);
    border-bottom: 2px solid #ddd;
}

.document-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    color: #555;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.document-table tbody tr:hover {
    background: #fafafa;
}

.doc-type-badge {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    display: inline-block;
}

.doc-file-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
}

.doc-file-link:hover {
    text-decoration: underline;
}

.doc-meta {
    font-size: 11px;
    color: #888;
}

.doc-actions-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.doc-action-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.doc-action-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.doc-action-btn.delete:hover {
    background: #ffe5e5;
    border-color: #dc3545;
    color: #dc3545;
}

/* Collapsible section styling */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    user-select: none;
    transition: all 0.2s ease;
}

.collapsible-header h2 {
    margin: 0;
    font-size: 17px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapse-indicator {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.collapsible-header.collapsed .collapse-indicator {
    transform: rotate(-90deg);
}

.collapsible-content {
    display: block;
    animation: slideDown 0.3s ease;
}

.collapsible-content.collapsed {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* Tab-based interface for Update Job section */
.tabs-wrapper {
    margin-top: 20px;
}

.tab-buttons {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid #eee;
    margin-bottom: 0;
    flex-wrap: wrap;
    background: white;
    border-radius: 8px 8px 0 0;
}

.tab-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #888;
    font-size: 13px;
    transition: all 0.3s ease;
    margin-right: 2px;
}

.tab-btn:hover {
    color: #333;
}

.tab-btn.active {
    color: #ed1c24;
    border-bottom-color: #ed1c24;
}

.tab-content-wrapper {
    background: white;
    padding: 16px;
    border-radius: 0 0 8px 8px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Refined status timestamp */
.status-timestamp {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    font-style: italic;
}

/* More compact approval section */
.approval-info {
    background: linear-gradient(135deg, #f0f7ff 0%, #e3f2fd 100%);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #1976d2;
    font-size: 13px;
}

.approval-info strong {
    color: #1565c0;
}

.approval-status {
    color: #28a745;
    font-weight: 600;
    margin-top: 4px;
}

/* Danger zone refinement */
.danger-section {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 4px solid #dc3545;
    padding: 12px;
    border-radius: 6px;
}

/* Heroicon styling */
svg {
    color: inherit;
}

button svg,
a svg,
h2 svg,
.tab-btn svg {
    flex-shrink: 0;
    line-height: 1;
}

.primary-button svg,
.secondary-button svg,
.danger-button svg {
    stroke-width: 2;
}

/* Billing Amount Input */
.billing-amount-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.billing-display {
    min-width: 70px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    color: #202020;
}

.edit-icon {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #007bff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.edit-icon:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: #0056b3;
}

.edit-icon:active {
    transform: scale(0.95);
}

.billed-amount-input {
    width: 100px;
    padding: 6px 8px !important;
    border: 2px solid #007bff !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-family: 'Roboto Mono', monospace !important;
    text-align: right;
    transition: all 0.2s ease;
}

.billed-amount-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.tally-row {
    background: #f9f9f9;
    border-top: 2px solid #e0e0e0;
    font-weight: 600;
}

/* Drawing Canvas Styles */
#drawingContainer {
    max-width: 100%;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#pdfCanvas, #drawingCanvas {
    max-width: 100%;
    height: auto;
    display: block;
}

#drawingCanvas {
    touch-action: none !important;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.tool-btn {
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-btn:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.tool-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-active {
    border: 3px solid #fff !important;
    box-shadow: 0 0 0 2px #333 !important;
}

@media (max-width: 768px) {
    #toolBar {
        flex-direction: column;
        gap: 10px;
    }

    #toolBar > div {
        width: 100%;
    }

    .tool-btn {
        padding: 10px 14px !important;
        font-size: 14px !important;
        width: 100%;
        text-align: center;
    }

    #drawingCanvas {
        cursor: pointer;
    }
}

/* ---------------------------------------------------------------------------
   Jobs table on phones: 9 fixed-width columns cannot share a 390px screen —
   every cell collapses to a one-or-two-character sliver. Below 700px the table
   is re-laid out as one stacked card per job. The markup stays a real table so
   the desktop view and the row-click handler are unchanged.
   --------------------------------------------------------------------------- */
@media (max-width: 700px) {
    .jobs-table {
        display: block;
        table-layout: auto;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        font-size: 14px;
    }

    .jobs-table thead {
        display: none;             /* headers are redundant once rows are cards */
    }

    .jobs-table tbody {
        display: block;
    }

    .jobs-table tbody tr.job-row {
        display: block;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.07);
        margin-bottom: 12px;
        padding: 12px 14px;
        position: relative;
    }

    /* Column widths are desktop-only; let content size itself in a card. */
    .jobs-table tbody tr.job-row td {
        display: block;
        width: auto !important;
        padding: 0;
        border-bottom: none;
    }

    /* Job name is the card's heading. The pill sits top-right on the date line. */
    .jobs-table td.job-name {
        font-size: 15px;
        font-weight: 700;
        margin-bottom: 2px;
    }

    .jobs-table td.cell-status {
        position: absolute;
        top: 12px;
        right: 14px;
        margin: 0;
    }

    .jobs-table td.cell-client {
        font-weight: 600;
        color: #202020;
        margin-bottom: 2px;
    }

    .jobs-table td.cell-address {
        color: #555;
        margin-bottom: 6px;
    }

    .jobs-table td.job-notes {
        margin-bottom: 8px;
    }

    /* Notes can breathe a little more in a card than in a table row. */
    .jobs-table td.job-notes > div {
        -webkit-line-clamp: 3;
        max-height: 4.05em;
    }

    /* Date sits on the top line, opposite the status pill. */
    .jobs-table td.cell-date {
        display: block;
        font-size: 12px;
        color: #777;
        padding-right: 100px !important;   /* clear of the pill */
    }

    /* PDF / billed / amount form one footer row. The generic td rule above sets
       display:block, so these need !important to sit side by side. */
    .jobs-table td.cell-pdf,
    .jobs-table td.cell-billed,
    .jobs-table td.cell-amount {
        display: inline-flex !important;
        align-items: center;
        gap: 4px;
        width: auto !important;
        font-size: 12px;
        color: #666;
        margin-right: 16px;
        vertical-align: middle;
    }

    .jobs-table td.cell-pdf::before { content: "PDF:"; }
    .jobs-table td.cell-amount::before { content: "Billed:"; }

    /* Give the footer row a little separation from the notes above it. */
    .jobs-table td.cell-pdf {
        margin-top: 4px;
    }

    /* Tap targets need to be finger-sized, not 13px desktop controls. */
    .jobs-table .billed-toggle {
        padding: 6px 12px;
        font-size: 14px;
    }

    .jobs-table .edit-icon {
        padding: 6px;
    }

    .jobs-table .edit-icon svg {
        width: 16px;
        height: 16px;
    }

    .jobs-table .billed-amount-input {
        width: 90px;
        font-size: 14px;
        padding: 5px 7px;
    }

    /* Hover is meaningless on touch; the desktop lift (scale + shadow) is
       explicitly cancelled here so it never fires on a phone. Cards use a
       simple press state instead. */
    .jobs-table tbody tr.job-row,
    .jobs-table tbody tr.job-row:hover,
    .jobs-table tbody tr.job-row:focus-visible {
        transform: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.07);   /* the card's own resting shadow */
        z-index: auto;
    }

    .jobs-table tbody tr.job-row:hover {
        background-color: white;
    }

    .jobs-table tbody tr.job-row:active {
        background-color: #ededed;
    }

    /* The admin tally is a table-level footer; keep it readable as a block. */
    .jobs-table tfoot,
    .jobs-table tfoot tr,
    .jobs-table tfoot td {
        display: block;
        width: auto !important;
    }

    .jobs-table tfoot tr.tally-row {
        background: white;
        border-radius: 12px;
        padding: 12px 14px;
        text-align: right;
    }

    .jobs-table tfoot td {
        text-align: right !important;
        padding-right: 0 !important;
    }
}

/* --- Job reference inline edit (job details page) --- */

.job-name-heading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* The heading carries the page-header's margins; keep them on the wrapper
   instead so the icon lines up with the text rather than floating above it. */
.job-name-heading h1 {
    margin: 0;
}

.job-name-heading .edit-icon {
    flex-shrink: 0;
}

.job-name-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 8px;
}

.job-name-form input[type="text"] {
    font-family: 'Roboto Mono', monospace;
    font-size: 18px;
    padding: 8px 10px;
    border: 2px solid #007bff;
    border-radius: 4px;
    min-width: 0;
    flex: 1 1 260px;
}

.job-name-form .primary-button,
.job-name-form .secondary-button {
    padding: 8px 16px;
    font-size: 14px;
    flex-shrink: 0;
}

.job-name-error {
    color: #dc3545;
    font-size: 14px;
    margin: 0 0 8px;
}

@media (max-width: 700px) {
    .job-name-form input[type="text"] {
        font-size: 16px; /* iOS zooms the viewport on focus below 16px */
        flex-basis: 100%;
    }
}

/* --- Admin > Job Statuses --- */

.status-alert {
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.status-alert-success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
}

.status-alert-error {
    background: #fdecea;
    border: 1px solid #f5c2c0;
    color: #b71c1c;
}

.status-add-form {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.status-add-form label {
    display: grid;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.status-add-form input[type="text"] {
    width: 220px;
}

.status-add-form input[type="color"] {
    width: 54px;
    height: 38px;
    padding: 2px;
    cursor: pointer;
}

.status-add-form .status-check {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    padding-bottom: 9px;
}

.status-add-form .status-check input {
    width: auto;
}

.status-hint {
    font-size: 13px;
    color: #666;
    margin: 10px 0 0;
}

.status-rows {
    display: grid;
    gap: 8px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #e3e3e3;
    border-radius: 9px;
    background: #fafafa;
    flex-wrap: wrap;
}

/* A hidden status still shows, dimmed, so it can be brought back. Only the
   labels fade: fading the buttons too made them look disabled. */
.status-row-hidden .status-preview,
.status-row-hidden .f-label,
.status-row-hidden .f-check span,
.status-row-hidden .f-usage,
.status-row-hidden input[type="text"],
.status-row-hidden input[type="color"] {
    opacity: 0.5;
}

.status-row-hidden {
    background: #f2f2f2;
    border-style: dashed;
}

.status-move {
    display: grid;
    gap: 2px;
}

.order-btn {
    border: 1px solid #d9d9d9;
    background: white;
    border-radius: 4px;
    width: 24px;
    height: 18px;
    line-height: 1;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    color: #555;
}

.order-btn:hover:not(:disabled) {
    background: #eee;
}

.order-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.inline-form {
    display: inline;
    margin: 0;
}

.status-edit-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
    min-width: 0;
    margin: 0;
}

.status-preview {
    min-width: 128px;
    text-align: center;
    font-size: 12px;
    padding: 5px 10px;
}

.status-edit-form label {
    display: grid;
    gap: 2px;
    margin: 0;
}

.status-edit-form .f-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #777;
    font-weight: 700;
}

.status-edit-form .f-name input {
    width: 170px;
    padding: 6px 8px;
}

.status-edit-form .f-colour input {
    width: 44px;
    height: 30px;
    padding: 2px;
    cursor: pointer;
}

.status-edit-form .f-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    white-space: nowrap;
}

.status-edit-form .f-check input {
    width: auto;
    margin: 0;
}

.readonly-input {
    background: #efefef;
    color: #555;
    cursor: not-allowed;
}

.builtin-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #e3f0ff;
    color: #0b63c5;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.f-usage {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.primary-button.small,
.danger-button.small {
    padding: 6px 12px;
    font-size: 12px;
}

.status-delete {
    margin-left: auto;
}

.status-notes {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #555;
}

.status-notes p {
    margin: 0 0 8px;
}

.status-notes p:last-child {
    margin-bottom: 0;
}

@media (max-width: 800px) {
    .status-row {
        align-items: flex-start;
    }

    .status-edit-form {
        gap: 9px;
    }

    .status-edit-form .f-name input {
        width: 100%;
        font-size: 16px; /* iOS zooms below 16px on focus */
    }

    .status-delete {
        margin-left: 0;
    }
}

/* --- Admin landing page --- */

.admin-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.admin-tile {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: white;
    border: 1px solid #e3e3e3;
    border-radius: 14px;
    padding: 18px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
    min-width: 0;
}

.admin-tile:hover,
.admin-tile:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    border-color: #d32f2f;
    text-decoration: none;
    color: inherit;
}

.admin-tile-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #fdecea;
    color: #d32f2f;
}

.admin-tile-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.admin-tile-title {
    font-size: 17px;
    font-weight: 700;
    color: #202020;
}

.admin-tile-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.45;
}

.admin-tile-meta {
    font-size: 12px;
    color: #8a8a8a;
    margin-top: 2px;
}

.admin-back {
    display: inline-block;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    margin-bottom: 8px;
}

.admin-back:hover {
    color: #d32f2f;
}

@media (prefers-reduced-motion: reduce) {
    .admin-tile {
        transition: none;
    }

    .admin-tile:hover,
    .admin-tile:focus-visible {
        transform: none;
    }
}

/* --- Status autosave on the job details page --- */

.status-autosave {
    display: grid;
    gap: 3px;
    margin-bottom: 14px;
}

.save-state {
    font-size: 12px;
    min-height: 16px; /* reserve the line so nothing shifts as the text appears */
    color: #777;
}

.save-state-busy {
    color: #777;
}

.save-state-ok {
    color: #1a7f4b;
    font-weight: 600;
}

.save-state-error {
    color: #d32f2f;
    font-weight: 600;
}

/* --- Admin > Users --- */

.user-add-card {
    margin-bottom: 18px;
}

.user-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    align-items: end;
}

.user-form-grid label {
    display: grid;
    gap: 4px;
    margin: 0;
    min-width: 0;
}

.user-form-grid .f-check {
    flex-direction: row;
    display: flex;
    align-items: center;
    gap: 7px;
    padding-bottom: 10px;
}

.user-form-grid .f-check input {
    width: auto;
    margin: 0;
}

.user-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.user-rows {
    display: grid;
    gap: 8px;
}

.user-row {
    display: grid;
    grid-template-columns: auto minmax(0, 2fr) auto auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid #e6e6e6;
    border-radius: 11px;
    background: #fff;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.user-row:hover {
    border-color: #d9d9d9;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

/* Deactivated accounts stay listed but read as switched off. */
.user-row-inactive {
    background: #fafafa;
    border-style: dashed;
}

.user-row-inactive .user-identity,
.user-row-inactive .user-avatar {
    opacity: 0.6;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #2b2b2b;
    color: white;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.user-identity {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #202020;
    overflow-wrap: anywhere;
}

.user-handle {
    font-size: 12px;
    color: #777;
    font-family: 'Roboto Mono', ui-monospace, monospace;
}

.user-email {
    font-size: 12px;
    color: #8a8a8a;
    overflow-wrap: anywhere;
}

.user-tags {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.user-inactive-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #eee;
    color: #777;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

.user-since {
    display: grid;
    gap: 1px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.user-actions {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.secondary-button.small {
    padding: 6px 12px;
    font-size: 12px;
}

.user-modal-body {
    display: grid;
    gap: 13px;
}

.user-modal-body label {
    display: grid;
    gap: 4px;
    margin: 0;
}

.user-modal-body .f-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
}

.user-modal-body .f-check input {
    width: auto;
    margin: 0;
}

.user-modal-body input:disabled {
    background: #efefef;
    color: #666;
    cursor: not-allowed;
}

.modal-lede {
    font-size: 13px;
    color: #666;
    margin: 0;
}

@media (max-width: 860px) {
    .user-row {
        grid-template-columns: auto minmax(0, 1fr);
        row-gap: 10px;
    }

    /* Tags, date and buttons drop under the name rather than squashing beside it. */
    .user-tags,
    .user-since,
    .user-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

    .user-form-grid input,
    .user-form-grid select,
    .user-modal-body input,
    .user-modal-body select {
        font-size: 16px; /* iOS zooms below 16px on focus */
    }
}

@media (prefers-reduced-motion: reduce) {
    .user-row {
        transition: none;
    }
}
