/* ============================================================
   RESET + BASE
============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #f5f6f8;
    color: #222;
    line-height: 1.5;
    padding-top: 48px;
    height: auto;
    overflow-y: auto;
}

/* ============================================================
   INDEX PAGE
============================================================ */

body.index-page {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	background: #f5f6f8;
	padding: 1rem;
}

.form-card--welcome {
	width: 100%;
	max-width: 380px;
	padding: 2rem;
	background: #ffffff;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.12);
	text-align: center;
}

.form-card--welcome h1 {
	margin-bottom: 1rem;
	font-size: 1.8rem;
	font-weight: 600;
}

.form-card--welcome p {
	margin-bottom: 1.5rem;
	font-size: 1rem;
	color: #444;
}

/* ============================================================
   LOGIN PAGE
============================================================ */
body.login-page {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	background: #f5f6f8;
	padding: 1rem;
}

.form-card {
	width: 100%;
	max-width: 380px;
	padding: 2rem;
	background: #ffffff;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.login-logo {
	text-align: center;
	margin-bottom: 1.5rem;
}

.login-logo img {
	max-width: 160px;
	height: auto;
}

.form-field {
	margin-bottom: 1rem;
}

.login-error {
	margin-bottom: 1rem;
}

/* ============================================================
   NAVIGATION BAR
============================================================ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    color: #fff;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.nav__menu {
    list-style: none;
    display: flex;
    gap: 1.25rem;
}

.nav__link {
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.nav__link:hover {
    background: rgba(255,255,255,0.15);
}

.nav__link--active {
    background: rgba(255,255,255,0.25);
}

.nav__user {
    position: relative;
    flex-shrink: 0;
}

.nav__user-trigger {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
}

.nav__user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: #fff;
    color: #222;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    min-width: 160px;
    z-index: 3000;
}

.nav__user-dropdown--open {
    display: block;
}

.nav__user-dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #222;
}

.nav__user-dropdown a:hover {
    background: #f0f0f0;
}

.nav__menu.nav__menu--open {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start;
    gap: 0.75rem;
    background: #1e293b;
    padding: 1rem;
    width: 100%;
    z-index: 2000;
}

.nav__menu.nav__menu--open a {
    width: 100%;
}

/* ============================================================
   CONTROL BAR
============================================================ */
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0 1rem 0;
    gap: 1rem;
}

.control-bar h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.page-with-controls .control-bar {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 900;
    background: #f5f6f8;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ddd;
}

.page-with-controls .control-bar .content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================================
	CONTROL BAR SAVE BUTTON ATTENTION EFFECT
============================================================ */
	/* SAVE BUTTON — SHAKE */
	.save-btn-shake {
		animation: saveShake 0.5s ease;
	}

	@keyframes saveShake {
		0% { transform: translateX(0); }
		20% { transform: translateX(-3px); }
		40% { transform: translateX(3px); }
		60% { transform: translateX(-3px); }
		80% { transform: translateX(3px); }
		100% { transform: translateX(0); }
	}

/* ============================================================
   PAGE SCROLL AREA
============================================================ */
.page-with-controls .page-scroll {
    margin-top: 54px;
    height: calc(100vh - 108px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================
   CONTENT WRAPPER
============================================================ */
.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================================
   ALERT SYSTEM
============================================================ */
#global-alert-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1100px;
    z-index: 5000;
    pointer-events: none;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: 500;
    pointer-events: auto;
}

.alert-success { background: #d1fae5; border-left: 4px solid #10b981; color: #065f46; }
.alert-error   { background: #fee2e2; border-left: 4px solid #dc2626; color: #991b1b; }
.alert-warning { background: #fef3c7; border-left: 4px solid #f59e0b; color: #92400e; }

/* ============================================================
   TABLE SYSTEM
============================================================ */
.table-wrapper {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.10);
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    table-layout: fixed;
}

.table th,
.table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    word-wrap: break-word;
    background-color: white;
}

.table tbody tr:hover {
    background: #f8fafc;
    cursor: pointer;
}

.section-divider td {
    background: #64748b;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.6rem 0.75rem;
}

.table th.num-cell,
.table td.num-cell {
    text-align: center;
    white-space: nowrap;
}

/* ============================================================
   BADGES
============================================================ */
.badge {
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge--good    { background: #d1fae5; color: #065f46; }
.badge--today   { background: #fef3c7; color: #92400e; }
.badge--overdue { background: #fee2e2; color: #991b1b; }
.badge--extreme { background: #b91c1c; color: #fff; }
.badge--none    { background: #e5e7eb; color: #374151; }

/* ============================================================
   TASK TAGS
============================================================ */
.task-tag {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 0.4rem;
}

.task-tag--ppm      { border: 1px solid #6b7280; color: #6b7280; background: rgba(107,114,128,0.08); }
.task-tag--oot      { border: 1px solid #2563eb; color: #2563eb; background: rgba(37,99,235,0.08); }
.task-tag--fu       { border: 1px solid #EAA302; color: #EAA302; background: rgba(234,179,8,0.12); }
.task-tag--priority { border: 1px solid #DC2626; color: #DC2626; background: rgba(220,38,38,0.10); }
.task-tag--progress { border: 1px solid #059669; color: #059669; background: rgba(5,150,105,0.08); }
.task-tag--qarag    { border: 1px solid #F97316; color: #F97316; background: rgba(249,115,22,0.10); }

/* ============================================================
   GLOBAL FORM LAYOUT - DESKTOP (DEFAULT)
============================================================ */
input, select, textarea {
    padding: 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 100%;
}

button {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
}

button:hover {
    background: #1d4ed8;
}

/* Global form button spacing + right alignment */
.form-card .button-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    gap: 1rem;
	margin-top: 1.5rem;
}

/* Global form centering */
.form-page {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
}

/* Center forms on form pages */
.add-asset-page .form-page {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
}

.add-asset-page .form-card {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.notes-textarea,
.readonly-notes {
    width: 100%;
    min-height: 140px;
    resize: vertical;
}

.related-section {
    margin-bottom: 1.5rem;
}

.related-section-last {
    margin-bottom: 0;
}

.related-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.related-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================================
   BUTTON SYSTEM
============================================================ */
.btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    border: none;
}

/* Make <a> and <button> identical */
.btn,
.btn:link,
.btn:visited,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
	padding: 0.55rem 0.9rem;
    line-height: 1;
    height: auto;
    border: none;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

/* Remove browser default button padding completely */
button.btn {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 0.55rem 0.9rem !important;
}

button.btn:disabled,
button.btn[disabled] {
    opacity: 0.6;              /* visual cue */
    cursor: not-allowed;
    padding: 0.55rem 0.9rem;   /* force same height */
    line-height: 1;            /* prevent shrink */
    height: auto;              /* override browser */
    border: none;              /* override browser */
    box-shadow: none;          /* some browsers add one */
}

/* Small button size */
.btn-small {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.875rem;
    line-height: 1.1;
}

button.btn-small {
    padding: 0.45rem 0.75rem !important;
}

.btn-full { width: 100%; display: block; }

.btn-grey  { background: #e5e7eb; color: #111827; }
.btn-grey:hover { background: #d1d5db; }

.btn-blue  { background: #2563eb; color: #fff; }
.btn-blue:hover { background: #1d4ed8; }

.btn-yellow { background: #f59e0b; color: #fff; }
.btn-yellow:hover { background: #d97706; }

.btn-red { background: #dc2626; color: #fff; }
.btn-red:hover { background: #b91c1c; }

.btn-orange { background-color: #f97316; color: #fff;}
.btn-orange:hover { background-color: #ea580c; }

.btn-violet { background-color: #8b5cf6; color: #fff; }
.btn-violet:hover { background-color: #7c3aed; }

.btn-green { background-color: #16a34a; color: #fff; }
.btn-green:hover { background-color: #15803d; }

/* ============================================================
   ICON BUTTONS
============================================================ */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;      /* circle size */
    height: 32px;     /* circle size */
    border-radius: 50%;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

/* HOVER CIRCLE */
.btn-icon:hover {
    background: rgba(0, 0, 0, 0.08); /* subtle grey hover */
}

/* ICONS THEMSELVES */
.btn-icon svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}


.icon-trash {
    fill: #dc3545;
    width: 20px;
    height: 20px;
    transition: opacity 0.15s ease;
}

.icon-trash:hover {
    background: rgba(220, 53, 69, 0.12);
	opacity: 0.8;
}

.icon-edit {
    fill: #2563eb;
    width: 20px;
    height: 20px;
    transition: opacity 0.15s ease;
}

.icon-edit:hover {
    background: rgba(37, 99, 235, 0.12);
	opacity: 0.8;
}

/* ============================================================
   VIEW USER TASKS — COLUMN WIDTHS
============================================================ */
.page-with-controls .table th.action-col,
.page-with-controls .table td.action-col {
    width: 5%;
    white-space: nowrap;
    text-align: center;
}

.page-with-controls .table th.date-col,
.page-with-controls .table td.date-col {
    width: 12%;
    white-space: nowrap;
    text-align: center;
}

/* ============================================================
   VIEW USERS — FULL-CELL CLICKABILITY
============================================================ */
.view-users-page .table td {
    padding: 0;
}

.view-users-page .table td a.cell-link {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0.75rem;
    text-decoration: none;
    color: inherit;
}

/* ============================================================ 
   STICKY HEADERS - DESKTOP (DEFAULT)
============================================================= */
.dashboard-page .table thead th {
    position: sticky;
    top: 0;
    background: #f5f6f8;
    z-index: 5;
}

.view-users-page .table thead th {
    position: sticky;
    top: 0;
    background: #f5f6f8;
    z-index: 5;
}

.view-user-tasks-page .table thead th {
    position: sticky;
    top: 0;
    background: #f5f6f8;
    z-index: 5;
}

.compliance-page .table thead th {
    position: sticky;
    top: 0;
    background: #f5f6f8;
    z-index: 5;
}


/* ============================================================
   CARD VIEW SYSTEM
============================================================ */
.task-cards {
    display: none;
}

.task-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.task-card-header {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #111;
}

.task-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.task-card-desc {
    font-size: 0.9rem;
    color: #333;
}

/* ============================================================
   UTILITIES
============================================================ */
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.py-2 { padding: 1rem 0; }
.text-center { text-align: center; }

/* ============================================================
   CHANGE PASSWORD PAGE
============================================================ */

.password-page {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.password-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    margin-top: 90px;
}

.strength-bar {
    height: 6px;
    width: 0%;
    background: #dc3545;
    transition: width 0.3s ease;
    margin-top: 4px;
    border-radius: 4px;
}

.strength-text {
    font-size: 0.9em;
    margin-top: 4px;
    color: #555;
}

.center-buttons {
    justify-content: center !important;
}

.center-buttons .btn {
    min-width: 140px;
}

.password-page .button-row {
	width: 100%;
	display: flex;
	gap: 1rem;
	justify-content: flex-end !important;
}

/* ============================================================
   ASSET DETAILS - DESKTOP (DEFAULT)
============================================================ */
.asset-details-page .subheading-muted {
    font-size: 0.9rem;
    color: #475569; /* slate-600/700 hybrid */
    font-weight: 500;
}

.asset-details-page .unsaved-warning {
    max-width: 1100px;
    margin: 0 auto 0.75rem auto;
}

/* Asset Details needs wider cards */
.asset-details-page .content-wrapper {
    max-width: 1400px;
}

.asset-details-page .form-card {
    max-width: 1400px;
}

.asset-details-page .form-page {
    max-width: 100%;
}

.asset-details-page form {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.asset-details-page .form-card,
.asset-details-page .related-section,
.asset-details-page .notes-textarea,
.asset-details-page .readonly-notes {
    margin-bottom: 1.25rem;
}

.asset-details-page .notes-textarea,
.asset-details-page .readonly-notes {
    resize: none;
}

/* ============================================================
   SAVE BUTTON — SHAKE ATTENTION EFFECT
============================================================ */
.asset-details-page .save-btn-shake {
    animation: saveShake;
}

@keyframes saveShake {
    0%   { transform: translateX(0); }
    20%  { transform: translateX(-4px); }
    40%  { transform: translateX(4px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); }
    100% { transform: translateX(0); }
}


/* ============================================================
   COMPLETE PPM PAGE 
============================================================ */
.complete-ppm-page .table thead th {
    position: sticky;
    top: 0;
    background: #f5f6f8;
    z-index: 5;
}

.complete-ppm-page .ppm-comments {
    margin-top: 1.5rem;
}

.complete-ppm-page .ppm-comments-box {
    width: 100%;
    min-height: 120px;
    resize: none;
}

.complete-ppm-page .ppm-complete-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
	gap: 1rem;
}

/* ============================================================
   COMPLETE PPM — DESKTOP (DEFAULT)
============================================================ */
.complete-ppm-page .cell-icon {
    display: none !important;
}

.complete-ppm-page .ppm-comments {
    margin-top: 1.5rem;
}

.complete-ppm-page .ppm-comments-box {
    width: 100%;
    min-height: 120px;
    resize: none;
}

.complete-ppm-page .ppm-complete-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ============================================================
   COMPLETE TASK — DESKTOP (DEFAULT)
============================================================ */
.complete-task-page .action-row {
    display: flex;
	justify-content: flex-end;
	margin-top: 1rem;
	gap: 0.5rem;
}

.complete-task-page .status-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.complete-task-page .status-row input[type="radio"] {
    margin-top: 3px; /* nudges the radio down to align with the label */
}

.complete-task-page .existing-comments {
    margin-bottom: 20px;
}

.complete-task-page .existing-comments label {
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.complete-task-page .existing-comments-box {
    background: #f7f7f7;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px 8px;
    text-align: left;
    white-space: normal;
    font-size: 14px;
    line-height: 1.25;
    display: block;
}

/* ============================================================
   EDIT LOCATION — DESKTOP (DEFAULT)
============================================================ */
.edit-location-page .card {
    max-width: 600px;
    margin: 0 auto;
}

.edit-location-page input[type="text"] {
    width: 100%;
    margin-bottom: 1rem;
}

.edit-location-page .control-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* ============================================================
   EDIT TASK — DESKTOP (DEFAULT)
============================================================ */
.edit-task-page .card {
    max-width: 700px;
    margin: 0 auto;
}

.edit-task-page .edit-textarea {
    width: 100%;
    min-height: 120px;
}

.edit-task-page textarea,
.edit-task-page .edit-textarea {
    resize: none !important;
}

.edit-task-page .control-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%; /* critical */
    gap: 1rem;
}

.edit-task-page .action-row {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 0.75rem;
}

/* ============================================================
   EDIT USER — DESKTOP (DEFAULT)
============================================================ */
.edit-user-page .control-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.edit-user-page .card {
    max-width: 700px;
    margin: 0 auto;
}

.edit-user-page input[type="text"],
.edit-user-page input[type="email"],
.edit-user-page input[type="password"],
.edit-user-page select {
    width: 100%;
}

.edit-user-page textarea,
.edit-user-page input[type="password"] {
    resize: none !important;
}

.edit-user-page .action-row {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 0.75rem;
}

.edit-user-page .form-group {
    margin-bottom: 1.25rem;
}

/* ============================================================
   EDIT WORKSHEET — DESKTOP (DEFAULT)
============================================================ */
.edit-worksheet-page .control-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.edit-worksheet-page .worksheet-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

.edit-worksheet-page .table-scroll {
    max-height: calc(100vh - 110px);
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.edit-worksheet-page .worksheet-table thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 5;
    border-bottom: 2px solid #ddd;
}

.edit-worksheet-page .num-cell {
    text-align: center;
    width: 60px;
}

.edit-worksheet-page .delete-cell {
    text-align: center;
    width: 60px;
}

.edit-worksheet-page .drag-handle {
    cursor: grab;
    opacity: 0.6;
    margin-right: 6px;
}

.edit-worksheet-page .drag-handle:hover {
    opacity: 1;
}

.edit-worksheet-page .desc-cell {
    cursor: pointer;
}

.edit-worksheet-page .desc-editing {
    width: 100%;
    min-height: 80px;
    resize: none;
    padding: 0.5rem;
    font-size: 0.95rem;
}

.edit-worksheet-page .no-steps {
    text-align: center;
    padding: 20px;
    color: #777;
    font-style: italic;
}

.edit-worksheet-page .control-buttons {
    display: flex;
    gap: 0.5rem;
}

/* EDIT WORKSHEET — DELETE BUTTON STYLE (Enhanced) */
.edit-worksheet-page .delete-step-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s ease;
}

/* Larger icon */
.edit-worksheet-page .delete-step-btn .icon-trash {
    width: 20px;
    height: 20px;
    fill: #dc3545;
    transition: opacity 0.15s ease;
}

/* Red hover circle */
.edit-worksheet-page .delete-step-btn:hover {
    background: rgba(220, 53, 69, 0.12);
}

.edit-worksheet-page .delete-step-btn:hover .icon-trash {
    opacity: 0.8;
}

/* ============================================================
   MANAGE LOCATIONS — DESKTOP (DEFAULT)
============================================================ */
.manage-locations-page .control-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.manage-locations-page .control-bar-content h2 {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manage-locations-page .control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.manage-locations-page .locations-card {
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

.manage-locations-page .table-scroll {
    max-height: calc(100vh - 110px);
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.manage-locations-page .locations-table thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 5;
    border-bottom: 2px solid #ddd;
}

.manage-locations-page .num-cell {
    text-align: center;
    width: 80px;
}

.manage-locations-page .no-locations {
    text-align: center;
    padding: 20px;
    color: #777;
    font-style: italic;
}

/* ============================================================
   MANAGE USERS — DESKTOP (DEFAULT)
============================================================ */
.manage-users-page .control-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.manage-users-page .control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.manage-users-page .users-card {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

.manage-users-page .table-scroll {
    max-height: calc(100vh - 110px);
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.manage-users-page .users-table thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 5;
    border-bottom: 2px solid #ddd;
}

/* HYBRID COLUMN WIDTHS */
.manage-users-page .col-username { width: 140px; }
.manage-users-page .col-name     { width: 180px; }
.manage-users-page .col-role     { width: 120px; }
.manage-users-page .col-email    { width: auto; }

/* ICON BUTTONS — EDIT */
.manage-users-page .edit-user-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.manage-users-page .edit-user-btn .icon-edit {
    fill: #2563eb;
    width: 20px;
    height: 20px;
    transition: opacity 0.15s ease;
}

.manage-users-page .edit-user-btn:hover {
    background: rgba(37, 99, 235, 0.12);
}

.manage-users-page .edit-user-btn:hover .icon-edit {
    opacity: 0.8;
}

/* ICON BUTTONS — DELETE */
.manage-users-page .delete-user-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.manage-users-page .delete-user-btn .icon-trash {
    fill: #dc3545;
    width: 20px;
    height: 20px;
    transition: opacity 0.15s ease;
}

.manage-users-page .delete-user-btn:hover {
    background: rgba(220, 53, 69, 0.12);
}

.manage-users-page .delete-user-btn:hover .icon-trash {
    opacity: 0.8;
}

/* MOBILE CARDS — HIDDEN ON DESKTOP */
.manage-users-page .users-cards-mobile {
    display: none;
}

/* ============================================================
   REMOVE LOCATION — DESKTOP (DEFAULT)
============================================================ */
.remove-location-page .control-bar-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
}

.remove-location-page .control-bar-content > a {
    margin-left: auto;
}

/* CONFIRM CARD */
.remove-location-page .confirm-card {
    max-width: 600px;
    margin: 2rem auto;
    padding: 1.5rem;
}

/* BUTTON ROW */
.remove-location-page .button-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ============================================================
   REMOVE USER — DESKTOP (DEFAULT)
============================================================ */
.remove-user-page .control-bar-content {
    display: flex !important;
    align-items: center;
    width: 100%;
}

.remove-user-page .control-bar-content > a {
    margin-left: auto !important;
}

.remove-user-page .confirm-card {
    max-width: 600px;
    margin: 2rem auto;
    padding: 1.5rem;
}

.remove-user-page .button-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ============================================================
   VIEW ASSETS — DESKTOP (DEFAULT)
============================================================ */
.view-assets-page .control-bar-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.view-assets-page #search {
    flex: 0 1 300px;
    max-width: 350px;
    width: 100%;
}

.view-assets-page .control-buttons {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.view-assets-page .control-buttons .btn {
    white-space: nowrap;
}

.view-assets-page .table-wrapper {
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    max-height: calc(100vh - 110px);
}

.view-assets-page table thead th {
    position: sticky;
    top: 0;
    background: #f8f8f8;
    z-index: 5;
}

/* COLUMN WIDTHS */
.view-assets-page .col-asset { width: 20%; }
.view-assets-page .col-desc  { width: 55%; }
.view-assets-page .col-loc   { width: 25%; }

.view-assets-page #search {
    flex: 0 1 300px;
    max-width: 350px;
    width: 100%;
}

/* ============================================================
   ADD TASK — DESKTOP (DEFAULT)
============================================================ */
	.add-task-page .form-card {
		max-width: 700px;
	}

	.add-task-page .form-row {
		margin-bottom: 1rem;
	}
	
	.add-task-page textarea {
		resize: none;
	}
	
	.add-task-page label {
		display: flex;
		align-items: center;
		gap: 8px;
		margin-bottom: 10px;
		font-size: 15px;
	}

	.add-task-page input[type="checkbox"] {
		width: 18px;
		height: 18px;
	}

/* ============================================================
   VIEW USER TASKS — DESKTOP (DEFAULT)
============================================================ */

	.view-user-tasks-page .sort-controls {
		display: flex;
		gap: 0.5rem;
	}

/* ============================================================
   COMPLIANCE PAGE - DESKTOP (DEFAULT)
============================================================ */
	.compliance-page .badge {
		padding: 0.35rem 0.6rem;
		border-radius: 4px;
		font-size: 0.8rem;
		font-weight: 600;
		display: inline-block;
		white-space: nowrap;
	}

	
	.compliance-page .badge--good { background: #d1fae5; color: #065f46; }
	.compliance-page .badge--soon { background: #fef3c7;	color: #92400e;	}
	.compliance-page .badge--overdue { background: #fee2e2; color: #991b1b; }
	.compliance-page .badge--extreme { background: #b91c1c; color: #fff; }
	.compliance-page .badge--none { background: #e5e7eb; color: #374151; }
	
	.compliance-page .table td {
		padding: 10px;
	}

/* ============================================================
   MOBILE MODE (UNIFIED)
============================================================ */

@media (max-width: 700px) {

/* --------------------------------------------
   GLOBAL MOBILE TWEAKS
-------------------------------------------- */
    .control-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .control-bar h2 {
        font-size: 1.2rem;
    }

    /* --------------------------------------------
       VIEW USER TASKS — MOBILE
    -------------------------------------------- */
    .view-user-tasks-page .control-bar h2 {
        display: none;
    }

    .view-user-tasks-page .table {
        display: none;
    }

    .view-user-tasks-page .task-cards {
        display: block;
    }

    /* --------------------------------------------
       VIEW USERS — MOBILE
    -------------------------------------------- */
    .view-users-page .table {
        display: none;
    }

    .view-users-page .task-cards {
        display: block;
    }

    /* --------------------------------------------
       DASHBOARD — MOBILE CARD LAYOUT
    -------------------------------------------- */
    .dashboard-page table.table {
        display: block;
        border: 0;
    }

    .dashboard-page table.table thead {
        display: none;
    }

    .dashboard-page table.table tbody {
        display: block;
    }

    .dashboard-page table.table tr {
        display: block;
        margin-bottom: 1rem;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 6px;
        padding: 0.75rem;
    }

    .dashboard-page table.table td {
        display: block;
        border: none;
        padding: 0.25rem 0;
    }

    .dashboard-page table.table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-bottom: 0.25rem;
        color: #555;
    }
	
	/* --------------------------------------
	   COMPLETE PPM — MOBILE CARD LAYOUT
	----------------------------------------- */
    .complete-ppm-page .control-bar h2 {
       font-size: 0.75rem;
    }

    .complete-ppm-page thead,
    .complete-ppm-page thead tr,
    .complete-ppm-page thead th {
        display: none !important;
    }

    .complete-ppm-page table,
    .complete-ppm-page tbody,
    .complete-ppm-page tr,
    .complete-ppm-page td {
        display: block;
        width: 100%;
    }

    .complete-ppm-page tr {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .complete-ppm-page td {
        padding: 6px 0;
    }

    .complete-ppm-page .cell-complete,
    .complete-ppm-page .cell-problem {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .complete-ppm-page .cell-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        margin-right: 6px;
    }

    .complete-ppm-page .cell-icon svg {
        display: block;
    }

    .complete-ppm-page input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    .complete-ppm-page .ppm-comments {
        margin-top: 1rem;
    }

    .complete-ppm-page .ppm-comments-box {
        min-height: 100px;
    }

    .complete-ppm-page .ppm-complete-wrapper {
        justify-content: center;
		flex-direction: column;
        gap: 0.75rem;
    }

    .complete-ppm-page .ppm-complete-wrapper button {
        width: 100%;
    }	


	/* Fix radio button alignment on complete_task page */
	.complete-task-page form .status-card {
		display: flex;
		flex-direction: column;
		gap: 0.75rem;
	}

	.complete-task-page form .status-row {
		margin-left: 3rem;
		display: flex;
		align-items: center; /* THIS is the real fix */
		gap: 1rem;
	}

	/* ============================================================
	   COMPLETE TASK — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .complete-task-page .page-scroll {
        padding: 0 1rem;
        height: auto !important;
        overflow: visible !important;
    }

    .complete-task-page form .card {
        padding: 1rem !important;
        border-radius: 8px;
        box-shadow: var(--card-shadow);
        margin-bottom: 1.5rem;
    }

    .complete-task-page form .status-row {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .complete-task-page form .status-text-block {
        flex: 1;
    }

    .complete-task-page .wide-textarea {
        width: 100% !important;
        min-height: 120px;
        font-size: 1rem;
    }

    .complete-task-page .action-row {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .complete-task-page .action-row .btn {
        width: 100%;
        text-align: center;
    }

    .complete-task-page .mobile-only .task-card {
        margin-bottom: 1rem;
    }

	/* ============================================================
	   EDIT LOCATION — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .edit-location-page .action-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100%;
    }

    .edit-location-page .action-row .btn {
        width: 100%;
    }
	
	.edit-location-page .control-bar-content h2 {
        display: none;
    }
	
	.edit-location-page .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

	/* ============================================================
	   EDIT TASK — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .edit-task-page .control-bar-content h2 {
        display: none;
    }

    .edit-task-page .action-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .edit-task-page .action-row .btn {
        width: 100%;
    }
	
	.edit-task-page .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

	/* ============================================================
	   EDIT USER — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .edit-user-page .control-bar-content h2 {
        display: none;
    }

    .edit-user-page .action-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .edit-user-page .action-row .btn {
        width: 100%;
    }
	
	.edit-user-page .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

	/* ============================================================
	   EDIT WORKSHEET — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .edit-worksheet-page .control-bar-content h2 {
        display: none;
    }

    .edit-worksheet-page .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .edit-worksheet-page .worksheet-card {
        padding: 0.75rem;
    }

	/* ============================================================
	   MANAGE LOCATIONS — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .manage-locations-page .control-bar-content h2 {
        display: none;
    }

    .manage-locations-page .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .manage-locations-page .locations-card {
        padding: 0.75rem;
    }

	/* ============================================================
	   MANAGE USERS — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .manage-users-page .users-table {
        display: none;
    }

    .manage-users-page .users-cards-mobile {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .manage-users-page .user-card {
        background: #fff;
        border-radius: 8px;
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        border: 1px solid #e5e5e5;
    }

    .manage-users-page .user-card-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.5rem;
    }

    .manage-users-page .user-card-row .label {
        font-weight: 600;
        color: #555;
    }

    .manage-users-page .user-card-row .value {
        text-align: right;
        color: #222;
    }

    .manage-users-page .user-card-actions {
        display: flex;
        justify-content: flex-end;
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

	/* ============================================================
	   REMOVE LOCATION — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .remove-location-page .control-bar-content h2 {
        display: none;
    }

    .remove-location-page .confirm-card {
        padding: 1rem;
        margin-top: 1rem;
    }

	/* ============================================================
	   REMOVE USER — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .remove-user-page .control-bar-content h2 {
        display: none;
    }

    .remove-user-page .confirm-card {
        padding: 1rem;
        margin-top: 1rem;
    }

	/* ============================================================
	   VIEW ASSETS — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
	.view-assets-page .page-scroll {
        margin-top: 90px;
    }

    .view-assets-page .control-bar {
        padding-bottom: 0.5rem;
    }

    .view-assets-page .control-bar-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    .view-assets-page #search {
        width: 100%;
        max-width: 100%;
        flex: none;
    }

    .view-assets-page .control-buttons {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .view-assets-page .control-buttons .btn {
        white-space: nowrap;
    }

	/* ============================================================
	   ASSET DETAILS — MOBILE LAYOUT FIXES (<700px)
	============================================================ */
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
	
	
    /* ============================================================
       VIEW TASKS — MOBILE LAYOUT FIXES (<700px)
   ============================================================ */

    /* Keep table visible */
    .view-user-tasks-page .table-wrapper table {
        display: table;
        width: 100%;
    }

    /* Make table rows stack vertically */
    .view-user-tasks-page .table tr {
        display: block;
        margin-bottom: 1rem;
        padding: 0.75rem;
        border: 1px solid #ddd;
        border-radius: 6px;
        background: #fff;
    }

    /* Hide table headers */
    .view-user-tasks-page .table thead {
        display: none;
    }

    /* Make each cell a row */
    .view-user-tasks-page .table td {
        display: flex;
        justify-content: space-between;
        padding: 0.35rem 0;
        font-size: 0.95rem;
        border: none;
    }

    /* Labels on the left */
    .view-user-tasks-page .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #444;
        margin-right: 0.5rem;
    }

    /* Improve spacing */
    .view-user-tasks-page .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}