/* =========================================================
   FIELDLINK PORTAL (10 DIGITS)
   Look and feel follows 10digits.net: near-black header,
   deep navy pages, navy cards, one bright blue accent and
   white type in the Segoe UI / system font stack.

   Card rules (keep these consistent on every page):
   - Info card (.panel, .stat-card, .form-card, .user-box):
     navy surface, 1px border, 12px corners. Never moves on
     hover and never shows an arrow.
   - Clickable card (add .card-link to an <a> card): same shape,
     plus a blue "Action →" label in the corner. On hover or
     focus the border turns blue and the card lifts slightly.
   - Clickable row action (.btn-open): blue outlined pill with
     an arrow. Every "Open", "Manage" or "Set up" link uses it.
   ========================================================= */

:root {
    --black: #040b12;
    --navy-950: #060d17;
    --navy-900: #08131f;
    --navy-850: #091627;
    --navy-800: #0d1b2c;
    --navy-750: #101e2d;
    --navy-700: #142538;
    --navy-glow: #0e243f;

    --line: #1e2c3b;
    --line-strong: #2a3a4c;

    --blue: #2e8ef7;
    --blue-hover: #1c7ae6;
    --blue-soft: rgba(46, 142, 247, 0.14);
    --blue-line: rgba(46, 142, 247, 0.45);
    --blue-text: #6cb0ff;
    --link-blue: #38bdf8;

    --text: #ffffff;
    --text-body: #c9d3de;
    --text-muted: #8d99a8;
    --text-faint: #66727f;

    --green: #34d399;
    --green-soft: rgba(52, 211, 153, 0.13);
    --red: #f87171;
    --red-soft: rgba(248, 113, 113, 0.12);
    --amber: #fbbf24;

    --white: #ffffff;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-pill: 999px;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 14px 32px rgba(0, 0, 0, 0.45);
    --shadow-blue: 0 8px 22px rgba(46, 142, 247, 0.28);

    --font:
        "Segoe UI",
        -apple-system,
        BlinkMacSystemFont,
        system-ui,
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;

    color-scheme: dark;
}

/* =========================================================
   BASE
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--navy-900);
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-body);
    background:
        radial-gradient(1200px 600px at 100% 0%, var(--navy-glow), transparent 60%),
        linear-gradient(180deg, var(--navy-850), var(--navy-900) 520px);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    color: var(--text);
    font-weight: 600;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

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

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.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;
}

/* =========================================================
   SIGN-IN PAGES
   ========================================================= */

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

.login-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
    border-right: 1px solid var(--line);
    background:
        radial-gradient(circle at 85% 15%, var(--navy-glow), transparent 45%),
        linear-gradient(160deg, var(--black), var(--navy-850));
    color: var(--text);
}

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

.login-powered {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-powered img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.login-powered p {
    margin: 0;
    color: var(--blue-text);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.login-product-logo {
    display: block;
    width: min(300px, 100%);
    height: auto;
    margin: 0 0 26px -4px;
}

.login-brand h1 {
    max-width: 560px;
    margin: 0;
    font-size: clamp(32px, 3.6vw, 48px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.login-brand-copy {
    max-width: 520px;
    margin: 22px 0 0;
    color: var(--text-body);
    font-size: 17px;
    line-height: 1.65;
}

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

.login-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.login-feature-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--blue);
    box-shadow: 0 0 10px rgba(46, 142, 247, 0.8);
}

.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

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

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

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

.login-card-subtitle {
    margin: 10px 0 28px;
    color: var(--text-muted);
    line-height: 1.55;
}

.login-support {
    margin-top: 26px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

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

.login-support a:hover,
.field-link-row a:hover {
    text-decoration: underline;
}

.field-link-row {
    margin-top: 8px;
    font-size: 13px;
    text-align: right;
}

.login-card h2 + .alert-success,
.login-card h2 + .alert-error {
    margin-top: 20px;
}

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

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    width: 264px;
    padding: 22px 16px 20px;
    border-right: 1px solid var(--line);
    background: var(--black);
    color: var(--text-body);
}

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

.sidebar-logo {
    width: 54px;
    height: 46px;
    flex: 0 0 54px;
    object-fit: contain;
}

.brand-name {
    display: block;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.1;
}

.brand-name-accent {
    color: var(--link-blue);
}

.brand-subtitle {
    display: block;
    margin-top: 4px;
    color: var(--blue);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.dispatch-online {
    margin: 0 4px 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--navy-800);
}

.dispatch-online-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.dispatch-online-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-pill);
    background: var(--green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

.dispatch-online-copy {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    background: var(--navy-800);
    color: var(--text);
}

.nav-link.active {
    background: var(--blue-soft);
    color: var(--blue-text);
    box-shadow: inset 3px 0 0 var(--blue);
}

.nav-icon {
    width: 20px;
    font-size: 16px;
    text-align: center;
}

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

.user-box {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--navy-800);
}

.user-role {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

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

.mobile-header,
.mobile-nav {
    display: none;
}

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

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

/* =========================================================
   PAGE HEADINGS
   ========================================================= */

.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: var(--radius-md);
    background: var(--blue);
    box-shadow: var(--shadow-blue);
    color: var(--white);
    font-size: 22px;
}

.page-heading h1,
.property-hero h1 {
    margin: 0;
    font-size: clamp(28px, 3.6vw, 36px);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--text-body);
    font-size: 16px;
    line-height: 1.6;
}

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

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

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

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

.panel,
.stat-card,
.form-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--navy-800);
    box-shadow: var(--shadow-card);
}

.panel {
    margin-bottom: 22px;
    overflow: hidden;
}

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

.panel-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.panel-subtitle {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.panel-body {
    padding: 22px;
}

.form-card {
    padding: 20px;
}

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

.form-card p {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

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

/* Clickable card */

.card-link {
    position: relative;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.card-link:hover,
.card-link:focus-visible {
    border-color: var(--blue-line);
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
    outline: none;
}

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.card-action-arrow {
    transition: transform 0.15s ease;
}

.card-link:hover .card-action-arrow,
.card-link:focus-visible .card-action-arrow {
    transform: translateX(3px);
}

/* Summary cards (Overview) */

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

.stat-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "icon body"
        "icon action";
    column-gap: 14px;
    row-gap: 10px;
    padding: 18px 20px;
}

.stat-icon {
    grid-area: icon;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--blue-line);
    border-radius: var(--radius-md);
    background: var(--blue-soft);
    color: var(--blue);
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-body {
    grid-area: body;
    display: grid;
    gap: 2px;
    min-width: 0;
}

.stat-title {
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.stat-detail {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.stat-card .card-action {
    grid-area: action;
    justify-self: end;
    align-self: end;
}

.permission-list {
    margin: 0;
    padding: 18px 22px 20px 42px;
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.9;
}

.permission-list li::marker {
    color: var(--blue);
}

/* Status pills */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: var(--radius-pill);
    background: currentColor;
}

.status-active {
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--green);
    background: var(--green-soft);
}

.status-inactive {
    border-color: var(--line-strong);
    color: var(--text-muted);
    background: var(--navy-750);
}

.status-info {
    border-color: var(--blue-line);
    color: var(--blue-text);
    background: var(--blue-soft);
}

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

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

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

.data-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
    background: var(--navy-750);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--text-body);
    font-size: 14px;
    vertical-align: top;
}

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

.table-primary {
    color: var(--text);
    font-weight: 600;
}

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

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

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

.company-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.priority-circle {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--blue-line);
    border-radius: var(--radius-pill);
    color: var(--blue-text);
    background: var(--blue-soft);
    font-weight: 600;
}

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

.field {
    margin-bottom: 18px;
}

.field label,
.add-property-form label,
.property-admin-form label,
.property-delete label {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.input,
.add-property-form input,
.property-admin-form input,
.property-delete input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: none;
    color: var(--text);
    background: var(--navy-950);
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder,
.add-property-form input::placeholder {
    color: var(--text-faint);
}

.input:hover,
.add-property-form input:hover,
.property-admin-form input:hover,
.property-delete input:hover {
    border-color: #3a4b5f;
}

.input:focus,
.add-property-form input:focus,
.property-admin-form input:focus,
.property-delete input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(46, 142, 247, 0.2);
}

.label-optional {
    color: var(--text-muted);
    font-weight: 400;
}

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

.add-property-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    padding: 20px 22px 22px;
}

.add-property-form .form-group {
    flex: 1 1 280px;
    min-width: 0;
    margin: 0;
}

.add-property-form .btn {
    min-height: 44px;
}

.add-property-form input.file-input {
    padding: 5px 8px;
    line-height: 32px;
    cursor: pointer;
}

.add-property-form input.file-input::file-selector-button {
    margin-right: 12px;
    padding: 5px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--navy-750);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

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

.inline-input {
    height: 38px;
    font-size: 14px;
}

.property-admin-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(165px, 1fr) auto;
    gap: 14px;
    align-items: end;
    min-width: 0;
}

.property-admin-form .form-group {
    min-width: 0;
    margin: 0;
}

.property-admin-form .btn {
    min-height: 44px;
    white-space: nowrap;
}

.property-lifecycle-form {
    margin: 0 0 10px;
}

.property-delete {
    margin-top: 8px;
}

.property-delete summary {
    color: var(--red);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.property-delete form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.add-user-form .form-group {
    flex: 1 1 280px;
}

.user-actions,
.order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

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

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

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

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    color: var(--white);
    background: var(--blue);
}

.btn-primary:hover:not(:disabled) {
    background: var(--blue-hover);
}

.btn-secondary {
    color: var(--text);
    background: transparent;
    border-color: #49535e;
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
    color: var(--red);
    background: transparent;
    border-color: rgba(248, 113, 113, 0.45);
}

.btn-danger:hover:not(:disabled) {
    background: var(--red-soft);
}

.btn-success {
    color: var(--green);
    background: transparent;
    border-color: rgba(52, 211, 153, 0.45);
}

.btn-success:hover:not(:disabled) {
    background: var(--green-soft);
}

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

.btn-full {
    width: 100%;
}

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

/* Clickable row action: "Open", "Manage", "Set up" */

.btn-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid var(--blue-line);
    border-radius: var(--radius-pill);
    color: var(--blue-text);
    background: var(--blue-soft);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.btn-open-inline {
    margin-top: 8px;
}

.btn-open-arrow {
    transition: transform 0.15s ease;
}

.btn-open:hover,
.btn-open:focus-visible {
    border-color: var(--blue);
    color: var(--white);
    background: var(--blue);
    outline: none;
}

.btn-open:hover .btn-open-arrow,
.btn-open:focus-visible .btn-open-arrow {
    transform: translateX(3px);
}

/* =========================================================
   LOCATION PAGE
   ========================================================= */

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

.property-hero > .status {
    justify-self: start;
}

.property-hero .panel-subtitle {
    font-size: 15px;
}

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

.meta-item {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.meta-item strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

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

/* =========================================================
   COMPANY LOGOS
   ========================================================= */

.company-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--white);
    object-fit: contain;
    overflow: hidden;
}

.company-avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.company-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    font-size: 19px;
}

.company-avatar-default {
    border-color: transparent;
    color: var(--white);
    background: var(--blue);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.logo-manager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    padding: 20px 22px 22px;
}

.logo-manager .logo-form {
    flex: 1 1 360px;
    padding: 0;
}

.logo-remove-form {
    align-self: flex-end;
    margin: 0;
}

.logo-remove-form .btn {
    min-height: 44px;
}

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

.alert-error,
.alert-success {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.45;
}

.alert-error {
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
    background: var(--red-soft);
}

.alert-success {
    border-color: rgba(52, 211, 153, 0.4);
    color: #a7f3d0;
    background: var(--green-soft);
}

.content-wrap > .alert-success,
.content-wrap > .alert-error {
    margin-top: 12px;
}

/* =========================================================
   FOOTER AND BACK TO TOP
   ========================================================= */

.app-footer {
    margin-top: 40px;
    padding: 22px 0 8px;
    border-top: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.app-footer p {
    margin: 0;
}

.app-footer-brand {
    color: var(--text-muted);
    font-weight: 600;
}

.app-footer-legal {
    max-width: 640px;
    margin: 4px auto 0 !important;
}

.login-card .app-footer {
    margin-top: 32px;
}

/* The portal allows no scripts, so back-to-top links to #top and,
   where the browser supports scroll-driven animations, fades in
   once the page has scrolled. */

.back-to-top {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-pill);
    background: var(--blue);
    box-shadow: var(--shadow-blue);
    color: var(--white);
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.back-to-top:hover {
    background: var(--blue-hover);
}

@supports (animation-timeline: scroll()) {
    .back-to-top {
        animation: back-to-top-reveal linear both;
        animation-timeline: scroll(root);
        animation-range: 0 240px;
    }

    @keyframes back-to-top-reveal {
        from {
            opacity: 0;
            visibility: hidden;
        }

        to {
            opacity: 1;
            visibility: visible;
        }
    }
}

.login-page .back-to-top {
    display: none;
}

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

@media (max-width: 1440px) {
    .property-admin-form,
    .inline-edit {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .property-admin-form .btn,
    .inline-edit .btn {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

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

    .sidebar {
        display: none;
    }

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

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

    .mobile-brand img {
        width: 40px;
        height: 40px;
        object-fit: contain;
    }

    .mobile-brand strong {
        display: block;
        color: var(--text);
        font-size: 15px;
        font-weight: 600;
    }

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

    .mobile-nav {
        display: block;
    }

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

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

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 42px;
        min-height: 42px;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius-sm);
        color: var(--text);
        background: transparent;
        font-size: 20px;
    }

    .mobile-nav[open] .mobile-menu-button {
        border-color: var(--blue);
        color: var(--blue);
    }

    .mobile-nav-panel {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: grid;
        gap: 4px;
        padding: 12px 16px 16px;
        border-bottom: 1px solid var(--line);
        background: var(--black);
        box-shadow: var(--shadow-lift);
    }

    .main-content {
        padding: 28px 16px 56px;
    }
}

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

    .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: 32px;
    }

    .login-mobile-brand img {
        width: 56px;
        height: 56px;
        object-fit: contain;
    }

    .login-mobile-brand strong {
        display: block;
        color: var(--text);
        font-size: 18px;
        font-weight: 600;
    }

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

    .page-heading {
        display: block;
    }

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

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

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

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

    .add-property-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 18px 18px;
    }

    .add-property-form .btn,
    .property-admin-form .btn {
        width: 100%;
    }

    .add-property-form input,
    .property-admin-form input,
    .input {
        height: 46px;
        font-size: 16px;
    }

    /* Tables become stacked rows on phones */

    .table-wrap {
        overflow-x: visible;
    }

    .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 18px;
        border-bottom: 1px solid var(--line);
    }

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

    .data-table td {
        padding: 6px 0;
        border: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .inline-edit {
        grid-template-columns: 1fr;
        width: 100%;
        min-width: 0;
    }

    .inline-edit input,
    .inline-edit .btn {
        width: 100%;
    }

    .order-actions .btn,
    .data-table td > .btn {
        max-width: 100%;
    }
}

/* The accent half of "FieldLink" sits inside the mobile brand's <strong>,
   so it must not pick up the small uppercase subtitle style. */
.login-mobile-brand strong .brand-name-accent,
.mobile-brand strong .brand-name-accent {
    display: inline;
    margin: 0;
    color: var(--link-blue);
    font-size: inherit;
    letter-spacing: inherit;
    text-transform: none;
}
