:root {
    --navy-950: #07111f;
    --navy-900: #0b1628;
    --navy-850: #10203a;
    --navy-800: #172944;
    --blue-600: #2563eb;
    --blue-500: #3478f6;
    --blue-100: #dbeafe;
    --cyan-400: #22d3ee;
    --green-600: #059669;
    --green-100: #d1fae5;
    --amber-600: #d97706;
    --amber-100: #fef3c7;
    --red-600: #dc2626;
    --red-100: #fee2e2;
    --slate-950: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-blue: 0 8px 22px rgba(37, 99, 235, 0.24);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--slate-950);
    background: var(--slate-50);
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) minmax(420px, 0.9fr);
    min-height: 100vh;
    background: var(--white);
}

.login-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
    background:
        radial-gradient(circle at 22% 18%, rgba(37, 99, 235, 0.32), transparent 34%),
        radial-gradient(circle at 80% 82%, rgba(34, 211, 238, 0.16), transparent 30%),
        linear-gradient(145deg, #06101e, #0b1930 58%, #0c2244);
    color: var(--white);
}

.login-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 560px;
}

.login-logo {
    width: 116px;
    height: 116px;
    object-fit: contain;
    border-radius: 24px;
    box-shadow: 0 0 38px rgba(37, 99, 235, 0.32);
    margin-bottom: 28px;
}

.login-kicker {
    margin: 0 0 14px;
    color: #60a5fa;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-brand h1 {
    max-width: 560px;
    margin: 0;
    font-size: clamp(36px, 5vw, 64px);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.login-brand-copy {
    max-width: 520px;
    margin: 24px 0 0;
    color: #cbd5e1;
    font-size: 17px;
    line-height: 1.7;
}

.login-feature-row {
    display: flex;
    gap: 24px;
    margin-top: 36px;
    flex-wrap: wrap;
}

.login-feature {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #dbeafe;
    font-size: 14px;
    font-weight: 700;
}

.login-feature-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #34d399;
    box-shadow: 0 0 14px rgba(52, 211, 153, 0.75);
}

.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background:
        linear-gradient(180deg, #ffffff, #f8fafc);
}

.login-card {
    width: min(100%, 440px);
}

.login-mobile-brand {
    display: none;
}

.login-card h2 {
    margin: 0;
    font-size: 31px;
    letter-spacing: -0.035em;
}

.login-card-subtitle {
    margin: 10px 0 30px;
    color: var(--slate-500);
    line-height: 1.55;
}

.login-support {
    margin-top: 28px;
    color: var(--slate-500);
    font-size: 13px;
    text-align: center;
}

.login-support a {
    color: var(--blue-600);
    font-weight: 700;
    text-decoration: none;
}

/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    display: flex;
    flex-direction: column;
    padding: 24px 18px 20px;
    background:
        radial-gradient(circle at 25% 0%, rgba(37, 99, 235, 0.24), transparent 32%),
        linear-gradient(180deg, var(--navy-900), var(--navy-950));
    color: #dbeafe;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    z-index: 20;
}

.sidebar-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 8px 24px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.34);
}

.brand-name {
    display: block;
    color: var(--white);
    font-size: 19px;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    display: block;
    margin-top: 5px;
    color: #60a5fa;
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 800;
}

.dispatch-online {
    margin: 0 4px 20px;
    padding: 15px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 12px;
    background: rgba(30, 58, 95, 0.7);
}

.dispatch-online-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #34d399;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.dispatch-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

.dispatch-online-copy {
    margin-top: 6px;
    color: #93c5fd;
    font-size: 11px;
    line-height: 1.4;
}

.nav-list {
    display: grid;
    gap: 6px;
    margin-top: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 13px;
    border-radius: 10px;
    color: #a9c7ec;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.nav-link:hover,
.nav-link:focus-visible {
    background: rgba(59, 130, 246, 0.13);
    color: var(--white);
}

.nav-link.active {
    color: var(--white);
    background: linear-gradient(135deg, #2563eb, #3478f6);
    box-shadow: var(--shadow-blue);
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 18px;
}

.sidebar-footer {
    margin-top: auto;
}

.user-box {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.72);
}

.user-email {
    overflow: hidden;
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.user-role {
    margin-top: 4px;
    color: #7dd3fc;
    font-size: 11px;
    text-transform: capitalize;
}

.logout-form {
    margin-top: 10px;
}

.mobile-header {
    display: none;
}

.main-content {
    grid-column: 2;
    min-width: 0;
    padding: 42px 42px 64px;
}

.content-wrap {
    width: min(100%, 1180px);
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.heading-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.heading-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 14px;
    background: linear-gradient(145deg, #2563eb, #3478f6);
    box-shadow: var(--shadow-blue);
    color: var(--white);
    font-size: 23px;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 38px);
    letter-spacing: -0.045em;
    line-height: 1.1;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--slate-500);
    line-height: 1.55;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================================
   CARDS / STATUS
   ========================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card,
.panel {
    border: 1px solid var(--slate-200);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    padding: 20px;
    border-radius: var(--radius-md);
}

.stat-label {
    color: var(--slate-500);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.stat-value {
    margin-top: 8px;
    font-size: 30px;
    font-weight: 850;
    letter-spacing: -0.04em;
}

.stat-detail {
    margin-top: 6px;
    color: var(--slate-500);
    font-size: 13px;
}

.panel {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 22px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--slate-200);
}

.panel-title {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.025em;
}

.panel-subtitle {
    margin: 5px 0 0;
    color: var(--slate-500);
    font-size: 13px;
    line-height: 1.5;
}

.panel-body {
    padding: 22px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 25px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
}

.status-active {
    color: var(--green-600);
    background: var(--green-100);
}

.status-inactive {
    color: var(--slate-500);
    background: var(--slate-100);
}

.status-info {
    color: var(--blue-600);
    background: var(--blue-100);
}

/* =========================================================
   TABLES
   ========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

.data-table th {
    padding: 12px 14px;
    border-bottom: 1px solid var(--slate-200);
    color: var(--slate-500);
    background: var(--slate-50);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    padding: 15px 14px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    font-size: 14px;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #fbfdff;
}

.table-primary {
    color: var(--slate-950);
    font-weight: 750;
}

.table-secondary {
    margin-top: 3px;
    color: var(--slate-500);
    font-size: 12px;
}

.table-link {
    color: var(--blue-600);
    font-weight: 750;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

/* =========================================================
   FORMS / BUTTONS
   ========================================================= */

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--slate-700);
    font-size: 13px;
    font-weight: 750;
}

.input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    outline: none;
    color: var(--slate-950);
    background: var(--white);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.input:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.inline-edit {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(135px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.inline-input {
    min-height: 38px;
    padding: 8px 10px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 750;
    font-size: 13px;
    text-decoration: none;
    transition:
        transform 0.1s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: var(--white);
    background: linear-gradient(135deg, #2563eb, #3478f6);
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    color: var(--slate-700);
    background: var(--white);
    border-color: var(--slate-300);
}

.btn-danger {
    color: var(--red-600);
    background: var(--white);
    border-color: #fecaca;
}

.btn-success {
    color: var(--green-600);
    background: var(--white);
    border-color: #a7f3d0;
}

.btn-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

.order-actions {
    display: flex;
    gap: 6px;
}

.order-actions form,
.action-form {
    margin: 0;
}

.order-btn {
    width: 34px;
    min-width: 34px;
    padding: 0;
    font-size: 16px;
}

/* =========================================================
   PROPERTY DETAILS
   ========================================================= */

.property-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
}

.property-meta {
    display: flex;
    gap: 10px 24px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.meta-item {
    color: var(--slate-600);
    font-size: 13px;
}

.meta-item strong {
    display: block;
    margin-top: 4px;
    color: var(--slate-950);
    font-size: 15px;
}

.priority-circle {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    color: var(--white);
    background: var(--navy-900);
    font-weight: 800;
}

.section-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
    gap: 22px;
    align-items: start;
}

.form-card {
    padding: 20px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--slate-50);
}

.form-card h3 {
    margin: 0 0 6px;
    font-size: 17px;
}

.form-card p {
    margin: 0 0 18px;
    color: var(--slate-500);
    font-size: 13px;
    line-height: 1.5;
}

.empty-state {
    padding: 34px 20px;
    color: var(--slate-500);
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 20px;
    color: var(--blue-600);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
}

/* =========================================================
   MOBILE NAV
   ========================================================= */

.mobile-nav {
    display: none;
}

.mobile-nav summary {
    cursor: pointer;
    list-style: none;
}

.mobile-nav summary::-webkit-details-marker {
    display: none;
}

.mobile-nav-panel {
    display: grid;
    gap: 6px;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--slate-200);
    background: var(--white);
}

/* =========================================================
   ALERTS
   ========================================================= */

.alert-error {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #991b1b;
    background: var(--red-100);
    font-size: 13px;
    line-height: 1.45;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 66px;
        padding: 10px 16px;
        border-bottom: 1px solid var(--slate-200);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        text-decoration: none;
    }

    .mobile-brand img {
        width: 42px;
        height: 42px;
        object-fit: contain;
        border-radius: 10px;
    }

    .mobile-brand strong {
        display: block;
        font-size: 14px;
    }

    .mobile-brand span {
        display: block;
        margin-top: 2px;
        color: var(--blue-600);
        font-size: 8px;
        font-weight: 800;
        letter-spacing: 0.12em;
        text-transform: uppercase;
    }

    .mobile-nav {
        display: block;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 42px;
        min-height: 42px;
        border: 1px solid var(--slate-300);
        border-radius: 10px;
        background: var(--white);
        font-size: 20px;
    }

    .main-content {
        padding: 28px 20px 54px;
    }
}

@media (max-width: 760px) {
    .login-page {
        display: block;
        background: var(--slate-50);
    }

    .login-brand {
        display: none;
    }

    .login-form-side {
        min-height: 100vh;
        padding: 28px 20px;
    }

    .login-mobile-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 34px;
    }

    .login-mobile-brand img {
        width: 60px;
        height: 60px;
        object-fit: contain;
        border-radius: 14px;
    }

    .login-mobile-brand strong {
        display: block;
        font-size: 18px;
    }

    .login-mobile-brand span {
        display: block;
        margin-top: 3px;
        color: var(--blue-600);
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0.13em;
        text-transform: uppercase;
    }

    .page-heading {
        display: block;
    }

    .page-actions {
        margin-top: 18px;
    }

    .stats-grid,
    .section-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .property-hero {
        grid-template-columns: 1fr;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline-edit {
        min-width: 360px;
    }
}

/* MOBILE MANAGEMENT LAYOUT */
@media (max-width: 760px) {
  .table-wrap { overflow-x: visible; width: 100%; }
  .data-table { min-width: 0; width: 100%; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 14px 16px; border-bottom: 1px solid var(--slate-200); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { padding: 6px 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .inline-edit { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; min-width: 0; }
  .inline-edit input, .inline-edit .btn { width: 100%; min-width: 0; }
  .order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .order-actions .btn, .data-table td > .btn { max-width: 100%; }
}
