:root {
    --bg: #f8fbf1;
    --surface: #ffffff;
    --ink: #17231c;
    --muted: #5f6d61;
    --line: #dfecca;
    --primary: #4f8f3a;
    --primary-dark: #356f35;
    --accent: #bfe35b;
    --accent-strong: #9fcd39;
    --accent-soft: #f0f9cf;
    --leaf-soft: #f2f8e8;
    --danger: #b42318;
    --shadow: 0 18px 42px rgba(74, 117, 51, .12);
}

.technical-tools button[data-tool="wall"]::before { content: "M"; }
.technical-tools button[data-tool="door"]::before { content: "D"; }
.technical-tools button[data-tool="window"]::before { content: "V"; }
.technical-tools button[data-tool="room"]::before { content: "H"; }
.technical-tools button[data-tool="lot"]::before { content: "L"; }
.technical-tools button[data-tool="install-point"]::before { content: "I"; }
.technical-tools button[data-tool="kitchen"]::before { content: "C"; }
.technical-tools button[data-tool="bath"]::before { content: "B"; }
.technical-tools button[data-tool="living"]::before { content: "S"; }
.technical-tools button[data-tool="dining"]::before { content: "Co"; }
.technical-tools button[data-tool="bedroom"]::before { content: "H"; }

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    background: #13251d;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

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

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: block;
    object-fit: cover;
    background: #fff;
    padding: 2px;
}

.brand small {
    display: block;
    margin-top: 4px;
    color: #bdd0c7;
}

.nav a {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255,255,255,.1);
}

.logout-form { margin-top: auto; }

.content {
    padding: 32px;
    overflow-x: hidden;
}

.auth-content {
    grid-column: 1 / -1;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #10241b 0%, #245b40 55%, #f0b84a 160%);
}

.login-panel {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 24px;
    align-items: stretch;
}

.login-copy {
    color: #fff;
    padding: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-copy h1,
.page-header h1 {
    margin: 8px 0 0;
    font-size: clamp(32px, 4vw, 54px);
    line-height: 1.02;
}

.login-copy p {
    max-width: 520px;
    color: #dce9e2;
    font-size: 18px;
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
}

.form-card,
.panel,
.table-section,
.work-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-card {
    padding: 28px;
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.primary-button,
.ghost-button {
    border: 0;
    border-radius: 8px;
    min-height: 44px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
}

.primary-button {
    background: var(--primary);
    color: #fff;
}

.primary-button:hover { background: var(--primary-dark); }

.ghost-button {
    width: 100%;
    background: rgba(255,255,255,.12);
    color: #fff;
}

.muted { color: var(--muted); }

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 24px;
}

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

.metrics-grid article {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics-grid strong {
    display: block;
    font-size: 34px;
}

.metrics-grid span {
    color: var(--muted);
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr);
    gap: 20px;
    align-items: start;
}

.panel {
    padding: 22px;
}

.panel h2,
.table-section h2,
.work-card h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

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

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

.table-section {
    margin-top: 24px;
    overflow: hidden;
}

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

.search {
    max-width: 280px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th, td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

.badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: #e9f5ee;
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 12px;
}

.table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 13px;
    border-radius: 999px;
    background: #2b6546;
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(43, 101, 70, 0.18);
}

.table-action:hover {
    background: #1f5036;
}

.cards-list {
    display: grid;
    gap: 16px;
}

.work-card {
    padding: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 18px;
}

.work-card p {
    color: var(--muted);
    margin: 8px 0;
}

.work-actions {
    display: grid;
    gap: 10px;
}

.alert {
    margin-bottom: 16px;
    padding: 13px 16px;
    border-radius: 8px;
    background: #eef8f2;
    border: 1px solid #bfe5cf;
}

.alert.error {
    background: #fff0ed;
    border-color: #ffcbc2;
    color: var(--danger);
}

.empty,
.empty-state {
    color: var(--muted);
}

.empty-state {
    min-height: 70vh;
    display: grid;
    place-content: center;
    text-align: center;
    gap: 12px;
}

@media (max-width: 980px) {
    .app-shell,
    .login-panel,
    .workspace-grid,
    .work-card {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .content,
    .login-copy,
    .form-card {
        padding: 20px;
    }

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

    .section-title {
        align-items: stretch;
        flex-direction: column;
    }

    .search {
        max-width: none;
    }
}

/* Light lime corporate theme */
body {
    background:
        radial-gradient(circle at 10% 0%, rgba(202, 232, 94, .28), transparent 28rem),
        radial-gradient(circle at 90% 10%, rgba(112, 183, 76, .18), transparent 24rem),
        linear-gradient(135deg, #fbfff4 0%, #f0f8df 48%, #f8fbf1 100%);
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(97, 154, 68, .96) 0%, rgba(75, 137, 62, .96) 54%, rgba(54, 111, 53, .98) 100%);
    box-shadow: 14px 0 34px rgba(75, 137, 62, .18);
}

.brand small,
.nav small {
    color: rgba(250, 255, 241, .82);
}

.nav a {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .16);
    transition: transform .22s ease, background .22s ease, box-shadow .22s ease;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, .24);
    box-shadow: 0 12px 26px rgba(35, 92, 44, .18);
    transform: translateX(2px);
}

.login-screen,
.auth-content {
    background:
        radial-gradient(circle at 18% 12%, rgba(208, 237, 100, .34), transparent 20rem),
        radial-gradient(circle at 82% 20%, rgba(99, 172, 76, .22), transparent 24rem),
        linear-gradient(135deg, #f9fff1 0%, #edf8d7 48%, #f7fbec 100%);
}

.dashboard-hero,
.dashboard-metrics article,
.admin-card,
.table-section,
.work-card,
.panel,
.form-card,
.record-item {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .94) 0%, rgba(246, 252, 232, .9) 100%);
    border-color: rgba(151, 195, 87, .28);
    box-shadow:
        14px 14px 32px rgba(112, 152, 78, .14),
        -10px -10px 24px rgba(255, 255, 255, .86);
}

.dashboard-hero::before,
.table-section::before,
.admin-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 0%, rgba(198, 230, 91, .16) 45%, transparent 72%);
    opacity: 0;
    animation: limeSheen 7s ease-in-out infinite;
}

.dashboard-hero,
.table-section,
.admin-card {
    position: relative;
    overflow: hidden;
}

.dashboard-hero > *,
.table-section > *,
.admin-card > * {
    position: relative;
    z-index: 1;
}

.primary-button,
.admin-card .primary-button,
.table-section .primary-button,
.btn-lime,
.mobile-action-strip a,
.table-action {
    background: linear-gradient(135deg, #c9eb61 0%, #86c947 52%, #58a64c 100%);
    color: #16351d;
    border: 1px solid rgba(255, 255, 255, .38);
    box-shadow: 0 12px 26px rgba(115, 174, 67, .26);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.primary-button:hover,
.admin-card .primary-button:hover,
.table-section .primary-button:hover,
.btn-lime:hover,
.mobile-action-strip a:hover,
.table-action:hover {
    background: linear-gradient(135deg, #d8f279 0%, #98d55a 50%, #65b55a 100%);
    box-shadow: 0 16px 32px rgba(115, 174, 67, .32);
    filter: saturate(1.04);
    transform: translateY(-1px);
}

.card-heading span,
.badge,
.metric-pill,
.status-dot {
    background: linear-gradient(135deg, #d7f36f, #8fce4f);
    color: #17351e;
    box-shadow: 0 10px 22px rgba(115, 174, 67, .22);
}

.eyebrow,
.dashboard-metrics strong,
.hero-copy h1,
.card-heading h2,
.table-section h2 {
    color: #2f6f34;
}

.mobile-action-strip a,
.search,
.admin-card input,
.admin-card select,
.admin-card textarea,
.inline-edit-form input,
.inline-edit-form select,
.inline-edit-form textarea,
input,
select,
textarea {
    border-color: rgba(151, 195, 87, .3);
    background: rgba(255, 255, 255, .84);
}

.admin-card input:focus,
.admin-card select:focus,
.admin-card textarea:focus,
.inline-edit-form input:focus,
.inline-edit-form select:focus,
.inline-edit-form textarea:focus,
.search:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(128, 190, 68, .74);
    box-shadow:
        0 0 0 4px rgba(199, 230, 91, .24),
        inset 2px 2px 5px rgba(103, 146, 73, .08);
}

.edit-row td {
    background: linear-gradient(135deg, rgba(246, 252, 232, .9), rgba(255, 255, 255, .88));
}

body.crud-modal-active {
    overflow: hidden;
}

.edit-row.modal-open {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid !important;
    place-items: center;
    padding: 18px;
    background: rgba(32, 58, 28, .36);
    backdrop-filter: blur(10px);
}

.edit-row.modal-open td {
    display: block;
    width: min(980px, 96vw);
    max-height: 88vh;
    overflow: auto;
    border-radius: 22px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.98), rgba(243, 251, 223, .98)) !important;
    box-shadow: 0 28px 70px rgba(62, 108, 48, .28);
}

.modal-close {
    float: right;
    margin: 0 0 12px 12px;
    border: 0;
    border-radius: 999px;
    padding: 9px 15px;
    background: linear-gradient(135deg, #eef9c8, #c3ec68);
    color: #17351e;
    font-weight: 900;
    cursor: pointer;
}

.danger-button {
    min-height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 0 16px;
    background: linear-gradient(135deg, #ffe1dd, #f06d5f) !important;
    color: #64190f !important;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(202, 74, 58, .18);
}

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

.modal-actions form {
    margin: 0;
}

table th {
    color: #2f6f34;
}

table tbody tr {
    transition: background .2s ease, transform .2s ease;
}

table tbody tr:not(.edit-row):hover {
    background: rgba(241, 249, 220, .72);
}

.brand-mark,
.dashboard-logo,
.access-logo,
.panel-logo {
    box-shadow:
        0 12px 28px rgba(126, 178, 73, .18),
        0 0 0 4px rgba(210, 239, 105, .2);
}

@keyframes limeSheen {
    0%, 72%, 100% {
        opacity: 0;
        transform: translateX(-18%);
    }
    42% {
        opacity: 1;
        transform: translateX(18%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-hero::before,
    .table-section::before,
    .admin-card::before {
        animation: none;
    }

    .primary-button,
    .btn-lime,
    .table-action,
    .nav a {
        transition: none;
    }
}

/* Layout interno separado y estilo app */
body:has(.content) {
    background: #f2f5ef;
}

.app-shell:has(.content) {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns .24s ease;
}

body.sidebar-collapsed .app-shell:has(.content) {
    grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: auto;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand-text,
.nav em,
.logout-form .ghost-button {
    transition: opacity .18s ease, width .18s ease;
}

.sidebar-toggle {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

body.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

body.sidebar-collapsed .brand {
    justify-content: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav em {
    width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
}

body.sidebar-collapsed .sidebar {
    padding-left: 14px;
    padding-right: 14px;
}

body.sidebar-collapsed .sidebar-top {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle {
    position: absolute;
    right: -16px;
    top: 22px;
    background: #245b3c;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.nav a span {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(255, 255, 255, .1);
}

.nav svg,
.module-card svg,
.mobile-tabbar svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav a.active span {
    background: rgba(168, 199, 67, .22);
    color: #dcefa2;
}

.nav a em {
    font-style: normal;
}

body.sidebar-collapsed .nav a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .logout-form .ghost-button {
    font-size: 0;
    padding: 0;
}

body.sidebar-collapsed .logout-form .ghost-button::before {
    content: "×";
    font-size: 24px;
}

.content {
    min-width: 0;
    width: 100%;
    padding: clamp(16px, 2.6vw, 30px);
}

.module-launcher {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.module-card {
    min-height: 180px;
    padding: 20px;
    border-radius: 18px;
    background: #eef3e9;
    border: 1px solid rgba(81, 103, 76, .14);
    box-shadow:
        14px 14px 30px rgba(81, 103, 76, .16),
        -10px -10px 24px rgba(255, 255, 255, .88);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #17231c;
}

.module-card span {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #245b3c;
    color: #fff;
    font-weight: 900;
}

.module-card svg {
    width: 23px;
    height: 23px;
}

.module-card strong {
    margin-top: 18px;
    font-size: 22px;
}

.module-card small {
    color: #667268;
    line-height: 1.45;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.module-header > a {
    min-width: 78px;
    min-height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #eef3e9;
    color: #245b3c;
    font-weight: 900;
    border: 1px solid rgba(81, 103, 76, .14);
    box-shadow:
        8px 8px 18px rgba(81, 103, 76, .14),
        -7px -7px 16px rgba(255, 255, 255, .86);
}

.module-header h1 {
    margin: 4px 0 0;
    color: #17231c;
    font-size: clamp(30px, 4vw, 44px);
}

.single-module {
    display: grid;
    grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.single-module > .table-section:only-child {
    grid-column: 1 / -1;
    width: 100%;
}

.mobile-tabbar {
    display: none;
}

@media (max-width: 1120px) {
    .module-launcher {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .single-module {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell:has(.content),
    body.sidebar-collapsed .app-shell:has(.content) {
        display: block;
        padding-bottom: 76px;
    }

    .sidebar {
        position: sticky;
        top: 0;
        height: auto;
        padding: 12px 14px;
        border-radius: 0 0 22px 22px;
    }

    .sidebar-toggle,
    .sidebar .nav,
    .sidebar .logout-form {
        display: none;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .content {
        padding: 12px;
    }

    .dashboard-hero {
        margin-top: 12px;
    }

    .module-launcher {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .module-card {
        min-height: 118px;
        padding: 18px;
        display: grid;
        grid-template-columns: 48px 1fr;
        align-items: center;
        column-gap: 14px;
    }

    .module-card strong {
        margin-top: 0;
        font-size: 20px;
    }

    .module-card small {
        grid-column: 2;
    }

    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .dashboard-metrics article {
        padding: 15px;
    }

    .module-header {
        margin-top: 12px;
    }

    .single-module {
        gap: 14px;
    }

    .mobile-tabbar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        z-index: 40;
        display: flex;
        gap: 6px;
        padding: 8px;
        border-radius: 22px;
        background: rgba(238, 243, 233, .95);
        border: 1px solid rgba(81, 103, 76, .16);
        box-shadow: 0 18px 42px rgba(23, 61, 42, .2);
        backdrop-filter: blur(12px);
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-tabbar::-webkit-scrollbar {
        display: none;
    }

    .mobile-tabbar a {
        flex: 0 0 72px;
        min-height: 48px;
        display: grid;
        place-items: center;
        gap: 2px;
        border-radius: 16px;
        color: #667268;
        font-weight: 900;
    }

    .mobile-logout {
        flex: 0 0 72px;
        margin: 0;
    }

    .mobile-logout button {
        width: 100%;
        min-height: 48px;
        border: 0;
        display: grid;
        place-items: center;
        gap: 2px;
        border-radius: 16px;
        background: transparent;
        color: #667268;
        font: inherit;
        font-weight: 900;
        cursor: pointer;
    }

    .mobile-tabbar a.active {
        background: #245b3c;
        color: #fff;
    }

    .mobile-tabbar span,
    .mobile-logout span {
        width: 22px;
        height: 22px;
        display: grid;
        place-items: center;
    }

    .mobile-tabbar small,
    .mobile-logout small {
        font-size: 10px;
    }
}

/* Mejoras exclusivas para escritorio */
@media (min-width: 761px) {
    .content {
        padding: 24px 32px 36px;
    }

    .alert {
        position: sticky;
        top: 16px;
        z-index: 35;
        width: min(560px, 100%);
        margin: 0 0 18px auto;
        box-shadow: 0 16px 34px rgba(23, 61, 42, .14);
    }

    .single-module {
        grid-template-columns: minmax(380px, 500px) minmax(520px, 1fr);
        gap: 24px;
        max-width: 1440px;
        margin: 0 auto;
    }

    .single-module > .admin-card {
        position: sticky;
        top: 24px;
        max-height: calc(100vh - 48px);
        overflow: auto;
        scrollbar-width: thin;
    }

    .single-module > .table-section {
        min-width: 0;
        max-height: calc(100vh - 48px);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .single-module > .table-section .compact-list,
    .single-module > .table-section .table-wrap {
        overflow: auto;
    }

    .single-module > .table-section .compact-list {
        max-height: calc(100vh - 130px);
    }

    .table-section .table-wrap {
        flex: 1;
    }

    table {
        min-width: 920px;
    }

    th,
    td {
        white-space: nowrap;
    }

    td:nth-child(1),
    td:nth-child(2),
    td:nth-child(3) {
        white-space: normal;
        min-width: 170px;
    }

    .records-grid,
    .module-launcher,
    .dashboard-metrics,
    .home-summary,
    .dashboard-hero {
        max-width: 1440px;
        margin-left: auto;
        margin-right: auto;
    }

    .module-launcher {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .dashboard-metrics {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .module-card {
        min-height: 170px;
    }
}

@media (min-width: 1280px) {
    .single-module {
        grid-template-columns: minmax(420px, 540px) minmax(680px, 1fr);
    }

    .content {
        padding-left: 40px;
        padding-right: 40px;
    }
}

/* Flujo de campo del instalador */
.order-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.order-card {
    display: grid;
    gap: 9px;
    padding: 18px;
    border-radius: 18px;
    background: #eef3e9;
    border: 1px solid rgba(81, 103, 76, .14);
    box-shadow:
        14px 14px 30px rgba(81, 103, 76, .16),
        -10px -10px 24px rgba(255, 255, 255, .88);
}

.order-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: #667268;
    font-size: 13px;
    font-weight: 800;
}

.order-card h2 {
    margin: 0;
    color: #17231c;
    font-size: 22px;
}

.order-card p {
    margin: 0;
    color: #4f5f54;
    line-height: 1.45;
}

.order-card small {
    color: #667268;
    line-height: 1.4;
}

.order-client-card {
    margin-bottom: 16px;
}

.field-report-form {
    display: grid;
    gap: 16px;
    padding-bottom: 86px;
}

.field-section {
    padding: 18px;
    border-radius: 18px;
    background: #eef3e9;
    border: 1px solid rgba(81, 103, 76, .14);
    box-shadow:
        14px 14px 30px rgba(81, 103, 76, .16),
        -10px -10px 24px rgba(255, 255, 255, .88);
    display: grid;
    gap: 12px;
}

.field-section h2 {
    margin: 0 0 2px;
    color: #17231c;
    font-size: 20px;
}

.field-section input,
.field-section select,
.field-section textarea {
    border: 1px solid rgba(81, 103, 76, .2);
    border-radius: 14px;
    background: rgba(255, 255, 255, .78);
    box-shadow:
        inset 3px 3px 7px rgba(81, 103, 76, .1),
        inset -3px -3px 7px rgba(255, 255, 255, .78);
}

.materials-rows {
    display: grid;
    gap: 10px;
}

.material-row {
    display: grid;
    grid-template-columns: 1fr 110px 90px;
    gap: 10px;
}

.checkline {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .58);
    color: #435146;
    font-weight: 800;
}

.checkline input {
    width: 20px;
    height: 20px;
    min-height: 20px;
}

.upload-field {
    min-height: 58px;
    display: grid;
    gap: 6px;
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .64);
    border: 1px solid rgba(81, 103, 76, .16);
    color: #435146;
    font-weight: 900;
}

.upload-field input {
    min-height: auto;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    font-size: 12px;
}

.print-act-button {
    min-height: 40px;
    display: inline-grid;
    place-items: center;
    padding: 0 16px;
    border-radius: 999px;
    background: #245b3c;
    color: #fff;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(36, 91, 60, .22);
    white-space: nowrap;
}

.drawing-board-wrap,
.signature-box {
    display: grid;
    gap: 8px;
}

.drawing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #173d2a;
}

.drawing-toolbar button {
    min-height: 34px;
    border: 0;
    border-radius: 999px;
    padding: 0 12px;
    background: rgba(36, 91, 60, .12);
    color: #173d2a;
    font-weight: 900;
    cursor: pointer;
}

[data-finish-drawing] {
    display: none;
}

.technical-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(36, 91, 60, .14);
    border-radius: 14px;
    background: rgba(247, 251, 242, .78);
}

.technical-tools summary {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 999px;
    background: #245b3c;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}

.technical-tools summary::-webkit-details-marker {
    display: none;
}

.technical-tools summary::after {
    content: "v";
    font-size: 13px;
    line-height: 1;
}

.technical-tools button {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    padding: 0 12px;
    background: #edf4e5;
    color: #244233;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.technical-tools button::before {
    content: "";
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: #fff;
    color: #245b3c;
    border: 1px solid rgba(36, 91, 60, .22);
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

.technical-tools button[data-tool="free"]::before { content: "✎"; }
.technical-tools button[data-tool="pipe"]::before { content: "━"; }
.technical-tools button[data-tool="pipe-hidden"]::before { content: "┄"; }
.technical-tools button[data-tool="pipe-wall"]::before { content: "╍"; }
.technical-tools button[data-tool="point"]::before { content: "●"; }
.technical-tools button[data-tool="elbow"]::before { content: "┗"; }
.technical-tools button[data-tool="tee"]::before { content: "┻"; }
.technical-tools button[data-tool="valve"]::before { content: "◇"; }
.technical-tools button[data-tool="meter"]::before { content: "◉"; }
.technical-tools button[data-tool="regulator"]::before { content: "▣"; }
.technical-tools button[data-tool="stove"]::before { content: "⊞"; }
.technical-tools button[data-tool="center"]::before { content: "⌂"; }

.technical-tools button.active::before,
.technical-tools button:focus-visible::before {
    background: #a8c743;
    color: #102619;
    border-color: rgba(255, 255, 255, .55);
}

.technical-tools button.active,
.technical-tools button:focus-visible {
    background: #245b3c;
    color: #fff;
    outline: none;
}

.technical-board.drawing-active {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: block;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: #f7fbf2;
    outline: 0;
    overflow: hidden;
}

.technical-board.drawing-active [data-start-drawing] {
    display: none;
}

.technical-board.drawing-active [data-finish-drawing] {
    display: inline-flex;
    align-items: center;
    background: #245b3c;
    color: #fff;
}

.technical-board.drawing-active .drawing-toolbar {
    position: absolute;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    top: max(8px, env(safe-area-inset-top));
    z-index: 5;
    justify-content: flex-start;
    flex-wrap: wrap;
    min-height: 46px;
    padding: 6px 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 8px 24px rgba(23, 61, 42, .16);
}

.technical-board.drawing-active .drawing-toolbar strong {
    margin-right: auto;
}

.technical-board.drawing-active .technical-tools {
    position: absolute;
    left: max(10px, env(safe-area-inset-left));
    right: auto;
    top: calc(max(8px, env(safe-area-inset-top)) + 58px);
    z-index: 6;
    display: block;
    min-width: min(280px, calc(100vw - 20px));
    max-width: min(360px, calc(100vw - 20px));
    overflow-x: auto;
    overflow-y: hidden;
    padding: 9px 10px 11px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px rgba(23, 61, 42, .18);
    -webkit-overflow-scrolling: touch;
}

.technical-board.drawing-active .technical-tools:not([open]) {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.technical-board.drawing-active .technical-tools:not([open]) button {
    display: none;
}

.technical-board.drawing-active .technical-tools[open] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.technical-board.drawing-active .technical-tools[open] summary {
    flex: 1 0 100%;
}

.technical-board.drawing-active .technical-tools button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 15px;
    font-size: 13px;
}

.technical-board.drawing-active .technical-canvas {
    position: absolute;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    top: calc(max(8px, env(safe-area-inset-top)) + 62px);
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100% - max(10px, env(safe-area-inset-left)) - max(10px, env(safe-area-inset-right)));
    height: calc(100% - max(10px, env(safe-area-inset-bottom)) - max(8px, env(safe-area-inset-top)) - 62px);
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 12px;
}

body.technical-editor-open {
    overflow: hidden;
}

.drawing-canvas {
    width: 100%;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(81, 103, 76, .22);
    touch-action: none;
}

.isometric-canvas {
    aspect-ratio: 900 / 520;
}

.signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.signature-canvas {
    aspect-ratio: 520 / 180;
}

.acta-digital {
    border: 2px solid rgba(36, 91, 60, .18);
}

.acta-titlebar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(81, 103, 76, .18);
}

.acta-titlebar img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
}

.acta-titlebar h2 {
    margin: 2px 0 0;
    text-transform: uppercase;
    letter-spacing: 0;
}

.acta-block {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .46);
    border: 1px solid rgba(81, 103, 76, .12);
}

.acta-block h3 {
    margin: 0;
    color: #173d2a;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.acta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.acta-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.two-acta-columns {
    grid-template-columns: 1fr 1fr;
}

.acta-block textarea {
    min-height: 74px;
}

@media (max-width: 980px) {
    .acta-grid,
    .acta-grid.compact,
    .two-acta-columns {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .acta-titlebar {
        align-items: flex-start;
    }

    .acta-titlebar img {
        width: 48px;
        height: 48px;
    }

    .acta-grid,
    .acta-grid.compact,
    .two-acta-columns {
        grid-template-columns: 1fr;
    }

    .acta-block {
        padding: 10px;
    }

    .signature-grid {
        grid-template-columns: 1fr;
    }

    .print-act-button {
        width: 100%;
    }
}

.secondary-button {
    min-height: 44px;
    border: 1px solid rgba(36, 91, 60, .24);
    border-radius: 999px;
    background: rgba(255, 255, 255, .68);
    color: #245b3c;
    font-weight: 900;
    cursor: pointer;
}

.sticky-save {
    position: sticky;
    bottom: 14px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 20px;
    background: rgba(238, 243, 233, .94);
    border: 1px solid rgba(81, 103, 76, .16);
    box-shadow: 0 18px 42px rgba(23, 61, 42, .18);
    backdrop-filter: blur(12px);
}

.sticky-save .primary-button {
    flex: 1;
}

.sticky-save .print-act-button {
    flex: 0 0 auto;
    min-height: 44px;
}

.sticky-save span {
    color: #667268;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 760px) {
    .field-report-form {
        padding-bottom: calc(190px + env(safe-area-inset-bottom));
    }

    .field-section {
        padding: 15px;
        gap: 10px;
    }

    .field-section h2 {
        font-size: 18px;
    }

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

    .sticky-save {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(88px + env(safe-area-inset-bottom));
        z-index: 55;
        display: grid;
        grid-template-columns: 1fr;
    }

    .sticky-save .print-act-button {
        width: 100%;
    }

    .technical-tools {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .technical-tools button {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 0 14px;
    }

    .technical-board.drawing-active {
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    }

    .technical-board.drawing-active .technical-canvas {
        min-height: 0;
    }
}

/* Refinamiento visual limon corporativo y tablas de escritorio */
body {
    background:
        radial-gradient(circle at top left, rgba(183, 216, 61, .22), transparent 32rem),
        linear-gradient(135deg, #f8fbef 0%, #eef6e6 48%, #f5f8ee 100%);
}

.sidebar {
    background: linear-gradient(180deg, #102c1d 0%, #173d2a 62%, #102619 100%);
    box-shadow: 14px 0 36px rgba(18, 52, 32, .18);
}

.nav a {
    background: rgba(255, 255, 255, .075);
    border: 1px solid rgba(255, 255, 255, .08);
}

.nav a.active,
.nav a:hover {
    background: rgba(183, 216, 61, .18);
    color: #f6ffd6;
}

.form-card,
.panel,
.table-section,
.work-card,
.metrics-grid article,
.field-section,
.acta-block {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(250, 253, 244, .93)),
        var(--surface);
    border-color: rgba(126, 154, 83, .22);
    box-shadow: 0 18px 44px rgba(28, 58, 38, .10);
}

.panel,
.table-section,
.work-card,
.field-section,
.acta-block {
    border-radius: 14px;
}

.module-card {
    background:
        linear-gradient(145deg, #ffffff 0%, #f2f8df 100%);
    border-color: rgba(159, 197, 36, .24);
    box-shadow: 0 18px 38px rgba(31, 80, 54, .12);
}

.module-card span,
.card-heading span,
.primary-button,
.mobile-tabbar a.active {
    background: linear-gradient(135deg, #214f35, #2f6a48);
}

.module-card span {
    box-shadow: inset 0 0 0 2px rgba(183, 216, 61, .34);
}

.eyebrow,
.badge {
    color: #214f35;
}

.badge {
    background: var(--accent-soft);
    border: 1px solid rgba(159, 197, 36, .32);
}

.primary-button {
    box-shadow: 0 12px 26px rgba(33, 79, 53, .22);
}

.primary-button:hover,
.table-action:hover {
    background: #123420;
}

input,
select,
textarea {
    border-color: rgba(112, 139, 83, .26);
    background: rgba(255, 255, 255, .94);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-strong);
    outline: 3px solid rgba(183, 216, 61, .24);
    box-shadow: 0 0 0 1px rgba(159, 197, 36, .18);
}

.section-title {
    background: linear-gradient(90deg, rgba(183, 216, 61, .16), rgba(255, 255, 255, .86));
    border-bottom-color: rgba(126, 154, 83, .2);
}

.table-wrap {
    background: rgba(255, 255, 255, .72);
    scrollbar-width: thin;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f3f8df;
    color: #214f35;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .02em;
}

td {
    color: #26352b;
}

tbody tr:nth-child(even) td {
    background: rgba(247, 250, 237, .62);
}

tbody tr:hover td {
    background: rgba(238, 248, 200, .72);
}

.record-item {
    background: linear-gradient(135deg, #fff, #f6faea);
    border-color: rgba(126, 154, 83, .2);
}

@media (min-width: 761px) {
    .single-module {
        grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
        max-width: 1680px;
        gap: 28px;
    }

    .single-module > .admin-card {
        max-height: calc(100vh - 56px);
    }

    .single-module > .table-section {
        max-height: none;
        min-height: calc(100vh - 150px);
    }

    .single-module > .table-section:only-child {
        grid-column: 1 / -1;
    }

    .table-section .table-wrap {
        max-width: 100%;
        border-radius: 0 0 14px 14px;
    }

    table {
        min-width: 760px;
        table-layout: auto;
    }

    th,
    td {
        padding: 13px 14px;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: normal;
        line-height: 1.35;
    }

    th {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    td:nth-child(1),
    td:nth-child(2),
    td:nth-child(3) {
        min-width: 0;
    }

    .table-section table td:first-child,
    .table-section table th:first-child {
        padding-left: 20px;
    }

    .table-section table td:last-child,
    .table-section table th:last-child {
        padding-right: 20px;
    }

    .table-action {
        min-width: max-content;
    }

    .search {
        max-width: 360px;
    }
}

@media (min-width: 1280px) {
    .single-module {
        grid-template-columns: minmax(340px, 440px) minmax(720px, 1fr);
    }
}

@media (max-width: 760px) and (orientation: portrait) {
    .technical-board.drawing-active::before {
        content: "Gira el telefono a horizontal para usar toda la pantalla";
        position: absolute;
        inset: auto 14px 14px;
        z-index: 2;
        padding: 10px 12px;
        border-radius: 14px;
        background: rgba(16, 38, 25, .9);
        color: #fff;
        text-align: center;
        font-size: 13px;
        font-weight: 900;
        pointer-events: none;
    }
}

/* Login neumorfico limon */
.auth-content {
    min-height: 100vh;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(168, 199, 67, .2), transparent 34%),
        linear-gradient(315deg, rgba(36, 91, 60, .14), transparent 42%),
        #f2f5ef;
}

.auth-box {
    width: min(920px, 96vw);
    min-height: clamp(470px, 78vh, 590px);
    border-radius: clamp(18px, 3vw, 28px);
    background: #eef3e9;
    box-shadow:
        22px 22px 48px rgba(81, 103, 76, .24),
        -16px -16px 34px rgba(255, 255, 255, .96),
        inset 1px 1px 0 rgba(255, 255, 255, .7);
    overflow: hidden;
    position: relative;
}

.auth-box::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 60%;
    width: 1px;
    background: rgba(107, 134, 89, .2);
    box-shadow: 1px 0 0 rgba(255, 255, 255, .78);
    z-index: 10;
    transition: left .72s cubic-bezier(.65, 0, .35, 1);
    pointer-events: none;
}

.auth-box.signup-mode::after {
    left: 40%;
}

.lime-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,.22), transparent 32%, rgba(168, 199, 67, .12)),
        repeating-linear-gradient(135deg, rgba(255,255,255,.16) 0 1px, transparent 1px 18px);
    opacity: .55;
    pointer-events: none;
}

.lime-orbit {
    display: none;
}

.panel {
    position: absolute;
    top: 0;
    height: 100%;
    transition: left .72s cubic-bezier(.65, 0, .35, 1);
}

.pA {
    left: 0;
    width: 60%;
    z-index: 1;
    background: rgba(255, 255, 255, .16);
    box-shadow: inset -10px 0 28px rgba(107, 134, 89, .08);
}

.auth-box.signup-mode .pA {
    left: 40%;
}

.pB {
    left: 60%;
    width: 40%;
    z-index: 3;
    overflow: hidden;
    background: #eef3e9;
    box-shadow:
        inset 9px 9px 20px rgba(81, 103, 76, .14),
        inset -9px -9px 20px rgba(255, 255, 255, .82);
}

.auth-box.signup-mode .pB {
    left: 0;
}

.d1,
.d2 {
    position: absolute;
    pointer-events: none;
    background: rgba(168, 199, 67, .2);
    box-shadow:
        8px 8px 18px rgba(81, 103, 76, .16),
        -8px -8px 18px rgba(255, 255, 255, .78);
}

.d1 {
    width: 150%;
    height: 86px;
    top: 34px;
    right: -44%;
    transform: rotate(-18deg);
    border-radius: 999px;
}

.d2 {
    width: 140%;
    height: 76px;
    bottom: 44px;
    left: -42%;
    transform: rotate(-18deg);
    border-radius: 999px;
}

.p-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 5vh, 54px) clamp(22px, 5vw, 58px);
}

.pA-reg {
    display: none;
}

.pA.show-reg .pA-login {
    display: none;
}

.pA.show-reg .pA-reg {
    display: flex;
}

.pB-hello,
.pB-welcome {
    text-align: center;
    transition: opacity .18s ease;
}

.pB-welcome {
    opacity: 0;
    pointer-events: none;
}

.pB.show-welcome .pB-hello {
    opacity: 0;
    pointer-events: none;
}

.pB.show-welcome .pB-welcome {
    opacity: 1;
    pointer-events: auto;
}

.fp-title {
    margin: 8px 0 10px;
    color: #17231c;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0;
}

.panel-logo {
    display: block;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        8px 8px 18px rgba(81, 103, 76, .18),
        -6px -6px 16px rgba(255, 255, 255, .9);
}

.panel-logo {
    width: 92px;
    height: 92px;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.access-logo {
    width: clamp(72px, 8vw, 92px);
    height: clamp(72px, 8vw, 92px);
    display: block;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
    margin: 10px 0 16px;
    box-shadow:
        10px 10px 22px rgba(81, 103, 76, .16),
        -8px -8px 18px rgba(255, 255, 255, .92);
}

.social-row {
    display: flex;
    gap: 12px;
    margin: 12px 0 8px;
}

.s-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #315f42;
    background: #eef3e9;
    display: grid;
    place-items: center;
    box-shadow:
        7px 7px 14px rgba(81, 103, 76, .24),
        -7px -7px 14px rgba(255, 255, 255, .95);
}

.s-icon svg {
    width: 21px;
    height: 21px;
    opacity: .62;
}

.s-icon.active {
    color: #102619;
    background: #a8c743;
    box-shadow:
        inset 4px 4px 8px rgba(59, 86, 50, .22),
        inset -4px -4px 8px rgba(255, 255, 255, .72);
}

.social-hint {
    max-width: 360px;
    margin: 0 0 20px;
    color: #647066;
    font-size: 14px;
    line-height: 1.55;
    text-align: center;
}

.field {
    width: 100%;
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
    color: #4f5f54;
    font-size: 13px;
    font-weight: 800;
}

.field input {
    min-height: 50px;
    border: 1px solid rgba(81, 103, 76, .22);
    border-radius: 14px;
    background: rgba(255, 255, 255, .76);
    color: #17231c;
    padding: 12px 16px;
    outline: none;
    box-shadow:
        inset 3px 3px 7px rgba(81, 103, 76, .11),
        inset -3px -3px 7px rgba(255, 255, 255, .78);
}

.field input:focus {
    border-color: rgba(87, 130, 72, .68);
    background: #fff;
    box-shadow:
        0 0 0 4px rgba(168, 199, 67, .2),
        inset 2px 2px 5px rgba(81, 103, 76, .08);
}

.btn-lime {
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 0 30px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    background: #245b3c;
    color: #f9fff3;
    font-weight: 900;
    letter-spacing: 0;
    box-shadow:
        0 13px 26px rgba(36, 91, 60, .28),
        inset 0 1px 0 rgba(255, 255, 255, .68);
    transition: transform .2s, box-shadow .22s, background .22s;
    position: relative;
    z-index: 1;
}

.btn-lime:hover {
    transform: translateY(-1px);
    background: #173d2a;
    box-shadow: 0 16px 30px rgba(36, 91, 60, .34);
}

.btn-full {
    width: 100%;
}

.login-note {
    margin: 16px 0 0;
    font-size: 12px;
    text-align: center;
}

.permission-list {
    width: 100%;
    display: grid;
    gap: 10px;
    margin: 10px 0 22px;
}

.permission-list span {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .7);
    color: #435146;
    font-weight: 800;
    box-shadow:
        inset 2px 2px 6px rgba(81, 103, 76, .1),
        inset -2px -2px 6px rgba(255, 255, 255, .82);
}

.o-title {
    position: relative;
    z-index: 1;
    color: #17231c;
    font-size: clamp(25px, 4vw, 38px);
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 14px;
}

.o-sub {
    position: relative;
    z-index: 1;
    max-width: 260px;
    margin: 0 0 26px;
    color: #667268;
    font-size: 14px;
    line-height: 1.72;
}

.mobile-nav {
    display: none;
}

@media (max-width: 720px) {
    .login-screen {
        align-items: start;
        padding: 14px;
    }

    .auth-box {
        width: min(440px, 100%);
        min-height: 0;
        margin: 0 auto;
        overflow: hidden;
        border-radius: 22px;
    }

    .auth-box::after,
    .pB,
    .d1,
    .d2 {
        display: none;
    }

    .mobile-nav {
        position: relative;
        z-index: 5;
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 8px;
        gap: 8px;
        background: #eef3e9;
        border-bottom: 1px solid rgba(81, 103, 76, .14);
    }

    .m-tab {
        min-height: 42px;
        border: 0;
        border-radius: 14px;
        background: transparent;
        color: #667268;
        font-weight: 900;
        cursor: pointer;
    }

    .auth-box:not(.signup-mode) .m-tab-si,
    .auth-box.signup-mode .m-tab-su {
        background: #245b3c;
        color: #f9fff3;
        box-shadow:
            6px 6px 14px rgba(81, 103, 76, .2),
            -4px -4px 12px rgba(255, 255, 255, .85);
    }

    .panel,
    .pA,
    .auth-box.signup-mode .pA {
        position: relative;
        left: 0;
        width: 100%;
        height: auto;
        transition: none;
        background: transparent;
        box-shadow: none;
    }

    .p-inner {
        position: relative;
        inset: auto;
        min-height: auto;
        padding: 28px 20px 24px;
    }

    .auth-box:not(.signup-mode) .pA-reg {
        display: none;
    }

    .auth-box.signup-mode .pA-login {
        display: none;
    }

    .auth-box.signup-mode .pA-reg {
        display: flex;
    }

    .fp-title {
        font-size: 38px;
    }

    .access-logo {
        width: 74px;
        height: 74px;
        margin: 6px 0 12px;
    }


    .social-hint {
        margin-bottom: 16px;
    }

    .field input {
        min-height: 52px;
    }
}

/* Dashboard corporativo movil */
.content {
    background:
        linear-gradient(135deg, rgba(168, 199, 67, .16), transparent 34%),
        linear-gradient(315deg, rgba(36, 91, 60, .1), transparent 42%),
        #f2f5ef;
}

.sidebar {
    background: #173d2a;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .08);
}

.brand-mark {
    background: #a8c743;
    border-radius: 50%;
    padding: 2px;
}

.nav a {
    background: rgba(255, 255, 255, .09);
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: clamp(20px, 4vw, 34px);
    margin-bottom: 18px;
    border-radius: 18px;
    background: #eef3e9;
    border: 1px solid rgba(81, 103, 76, .14);
    box-shadow:
        16px 16px 36px rgba(81, 103, 76, .18),
        -12px -12px 28px rgba(255, 255, 255, .88);
}

.hero-copy h1 {
    margin: 6px 0 8px;
    color: #17231c;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.02;
}

.hero-copy p {
    max-width: 620px;
    margin: 0;
    color: #667268;
    line-height: 1.6;
}

.dashboard-logo {
    width: clamp(72px, 9vw, 104px);
    height: clamp(72px, 9vw, 104px);
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    flex: 0 0 auto;
    box-shadow:
        8px 8px 18px rgba(81, 103, 76, .16),
        -7px -7px 16px rgba(255, 255, 255, .92);
}

.mobile-action-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.mobile-action-strip a {
    min-height: 42px;
    display: grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef3e9;
    color: #245b3c;
    font-weight: 900;
    font-size: 13px;
    border: 1px solid rgba(81, 103, 76, .12);
    box-shadow:
        7px 7px 16px rgba(81, 103, 76, .14),
        -6px -6px 14px rgba(255, 255, 255, .88);
}

.dashboard-metrics article,
.admin-card,
.table-section {
    background: #eef3e9;
    border: 1px solid rgba(81, 103, 76, .14);
    box-shadow:
        14px 14px 30px rgba(81, 103, 76, .16),
        -10px -10px 24px rgba(255, 255, 255, .88);
}

.dashboard-metrics article {
    border-radius: 16px;
}

.dashboard-metrics strong {
    color: #173d2a;
}

.admin-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.admin-card {
    padding: 20px;
    border-radius: 18px;
}

.card-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-heading span {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #245b3c;
    color: #f9fff3;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(36, 91, 60, .24);
}

.card-heading h2 {
    margin: 0;
    font-size: 19px;
    color: #17231c;
}

.admin-card input,
.admin-card select,
.admin-card textarea,
.search {
    border: 1px solid rgba(81, 103, 76, .2);
    border-radius: 14px;
    background: rgba(255, 255, 255, .76);
    box-shadow:
        inset 3px 3px 7px rgba(81, 103, 76, .1),
        inset -3px -3px 7px rgba(255, 255, 255, .78);
}

.admin-card input:focus,
.admin-card select:focus,
.admin-card textarea:focus,
.search:focus {
    outline: none;
    border-color: rgba(87, 130, 72, .68);
    box-shadow:
        0 0 0 4px rgba(168, 199, 67, .2),
        inset 2px 2px 5px rgba(81, 103, 76, .08);
}

.admin-card .primary-button,
.table-section .primary-button {
    background: #245b3c;
    border-radius: 999px;
    box-shadow: 0 13px 26px rgba(36, 91, 60, .24);
}

.admin-card .primary-button:hover,
.table-section .primary-button:hover {
    background: #173d2a;
}

.records-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.compact-list {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.two-column-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.record-item {
    padding: 13px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .62);
    border: 1px solid rgba(81, 103, 76, .1);
}

.record-item strong {
    display: block;
    color: #17231c;
    line-height: 1.35;
}

.record-item span {
    display: block;
    margin-top: 4px;
    color: #667268;
    font-size: 13px;
}

.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.table-filters .search,
.table-filters select {
    min-width: min(220px, 100%);
}

.edit-row td {
    background: rgba(238, 246, 227, .8);
    padding: 14px;
}

.inline-edit-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.wide-edit-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.inline-edit-form input,
.inline-edit-form select,
.inline-edit-form textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(81, 103, 76, .18);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .84);
    color: #17231c;
    font: inherit;
}

.inline-edit-form textarea {
    min-height: 42px;
    resize: vertical;
}

.inline-edit-form .primary-button {
    min-height: 42px;
}

.nested-title {
    margin-top: 18px;
    border-top: 1px solid rgba(81, 103, 76, .12);
}

.table-section {
    border-radius: 18px;
}

.section-title {
    border-bottom-color: rgba(81, 103, 76, .14);
}

.badge {
    background: rgba(168, 199, 67, .22);
    color: #173d2a;
}

@media (max-width: 980px) {
    .content {
        padding: 18px;
    }

    .sidebar {
        height: auto;
        padding: 16px;
    }

    .logout-form {
        margin-top: 0;
    }

    .admin-modules,
    .records-grid {
        grid-template-columns: 1fr;
    }

    .inline-edit-form,
    .wide-edit-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .content {
        padding: 12px;
    }

    .dashboard-hero {
        align-items: flex-start;
        padding: 18px;
        border-radius: 18px;
    }

    .table-filters {
        width: 100%;
        justify-content: stretch;
    }

    .table-filters .search,
    .table-filters select,
    .inline-edit-form,
    .wide-edit-form {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .hero-copy h1 {
        font-size: 30px;
    }

    .hero-copy p {
        font-size: 14px;
    }

    .dashboard-logo {
        width: 66px;
        height: 66px;
    }

    .mobile-action-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-action-strip a {
        min-height: 46px;
    }

    .admin-card {
        padding: 16px;
    }

    .two-column-list {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 760px;
    }
}

/* Final lime override: keep the whole platform light and gradient-based. */
:root {
    --bg: #fbfff4;
    --surface: #ffffff;
    --ink: #21351f;
    --muted: #6d8064;
    --line: #dbeebd;
    --primary: #7fc64a;
    --primary-dark: #5eac4a;
    --accent: #d7f36f;
    --accent-strong: #aeda42;
    --accent-soft: #f3fad9;
    --leaf-soft: #f5fbe9;
    --shadow: 0 18px 42px rgba(112, 166, 75, .14);
}

body,
.app-shell,
.content,
.auth-content {
    background:
        radial-gradient(circle at 8% 4%, rgba(218, 244, 116, .34), transparent 25rem),
        radial-gradient(circle at 88% 10%, rgba(128, 205, 84, .22), transparent 24rem),
        linear-gradient(135deg, #fcfff5 0%, #eff9dc 46%, #f9fdf0 100%) !important;
    color: #21351f;
}

.sidebar {
    background:
        linear-gradient(160deg, rgba(214, 244, 112, .94) 0%, rgba(145, 212, 87, .96) 48%, rgba(95, 181, 83, .98) 100%) !important;
    color: #17351e !important;
    box-shadow: 12px 0 32px rgba(119, 180, 82, .2) !important;
}

.sidebar a,
.sidebar button,
.brand strong,
.brand small {
    color: #17351e !important;
}

.nav a,
.ghost-button,
.logout-form button {
    background: linear-gradient(135deg, rgba(255,255,255,.52), rgba(238, 250, 202, .68)) !important;
    color: #17351e !important;
    border: 1px solid rgba(255, 255, 255, .52) !important;
    box-shadow: 0 10px 22px rgba(107, 169, 74, .18) !important;
}

.nav a:hover,
.nav a.active {
    background: linear-gradient(135deg, rgba(255,255,255,.76), rgba(219, 244, 129, .76)) !important;
    transform: translateX(2px);
}

.login-screen,
.auth-box,
.pB,
.mobile-nav {
    background:
        radial-gradient(circle at 20% 15%, rgba(222, 246, 123, .38), transparent 18rem),
        linear-gradient(135deg, #fbfff4 0%, #eef9d8 50%, #f8fdef 100%) !important;
}

.panel,
.form-card,
.admin-card,
.table-section,
.work-card,
.dashboard-hero,
.dashboard-metrics article,
.metrics-grid article,
.record-item,
.metric-card,
.order-card {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(246, 253, 226, .92)) !important;
    border-color: rgba(166, 211, 92, .34) !important;
    box-shadow:
        14px 14px 30px rgba(119, 166, 86, .13),
        -10px -10px 24px rgba(255, 255, 255, .88) !important;
}

.primary-button,
.btn-lime,
.table-action,
.admin-card .primary-button,
.table-section .primary-button,
.mobile-action-strip a,
.card-heading span,
.badge,
button[type="submit"] {
    background: linear-gradient(135deg, #e2f77c 0%, #b8e55d 34%, #7dcb54 68%, #60ba62 100%) !important;
    color: #17351e !important;
    border: 1px solid rgba(255, 255, 255, .55) !important;
    box-shadow: 0 12px 26px rgba(118, 186, 75, .28) !important;
}

.primary-button:hover,
.btn-lime:hover,
.table-action:hover,
.admin-card .primary-button:hover,
.table-section .primary-button:hover,
.mobile-action-strip a:hover,
button[type="submit"]:hover {
    background: linear-gradient(135deg, #edfb99 0%, #c8ed6d 34%, #91d761 70%, #70c775 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(118, 186, 75, .34) !important;
}

.eyebrow,
.hero-copy h1,
.dashboard-metrics strong,
.metrics-grid strong,
.card-heading h2,
.table-section h2,
.panel h2,
.work-card h2,
.record-item strong,
table th {
    color: #4f963c !important;
}

input,
select,
textarea,
.search,
.admin-card input,
.admin-card select,
.admin-card textarea,
.inline-edit-form input,
.inline-edit-form select,
.inline-edit-form textarea {
    background: rgba(255, 255, 255, .88) !important;
    border-color: rgba(166, 211, 92, .34) !important;
    color: #21351f !important;
}

input:focus,
select:focus,
textarea:focus,
.search:focus {
    border-color: rgba(132, 203, 80, .8) !important;
    box-shadow:
        0 0 0 4px rgba(216, 244, 112, .28),
        inset 2px 2px 5px rgba(119, 166, 86, .08) !important;
}

table tbody tr:not(.edit-row):hover,
.edit-row td {
    background: linear-gradient(135deg, rgba(251,255,244,.92), rgba(235, 249, 198, .78)) !important;
}

.d1,
.d2,
.s-icon,
.m-tab,
.field input {
    background: linear-gradient(145deg, #ffffff, #f0fad8) !important;
}

.o-title,
.fp-title,
.field span {
    color: #3f8339 !important;
}

.dashboard-hero::after,
.admin-card::after,
.table-section::after {
    content: "";
    position: absolute;
    inset: -40% auto auto -30%;
    width: 60%;
    height: 180%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent);
    transform: rotate(12deg);
    animation: limeSweep 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes limeSweep {
    0%, 72%, 100% {
        opacity: 0;
        translate: -30% 0;
    }
    38% {
        opacity: 1;
        translate: 190% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-hero::after,
    .admin-card::after,
    .table-section::after {
        animation: none !important;
    }
}

/* Menu-only polish: white brand banner + separated white option buttons. */
.sidebar {
    padding: 0 18px 18px !important;
    background:
        linear-gradient(180deg, #ffffff 0 104px, rgba(224, 247, 126, .96) 104px, rgba(143, 215, 89, .98) 56%, rgba(95, 186, 95, .98) 100%) !important;
    color: #17351e !important;
    box-shadow: 14px 0 34px rgba(100, 160, 74, .18) !important;
}

.sidebar-top {
    min-height: 104px;
    margin: 0 -18px 18px;
    padding: 18px;
    background: #ffffff !important;
    border-bottom: 1px solid rgba(166, 211, 92, .24);
    box-shadow: 0 12px 26px rgba(104, 157, 76, .1);
}

.brand {
    color: #17351e !important;
}

.brand strong {
    color: #17351e !important;
}

.brand small {
    color: #6d8064 !important;
}

.brand-mark {
    background: #ffffff !important;
    box-shadow:
        0 10px 24px rgba(116, 176, 76, .16),
        0 0 0 4px rgba(219, 244, 129, .2) !important;
}

.sidebar-toggle {
    background: linear-gradient(135deg, #f4fbdb, #d7f36f) !important;
    color: #17351e !important;
    border: 1px solid rgba(166, 211, 92, .42) !important;
}

.sidebar .nav {
    display: grid;
    gap: 10px;
}

.sidebar .nav a,
.sidebar .logout-form .ghost-button {
    background: linear-gradient(135deg, #ffffff 0%, #f8fde8 100%) !important;
    color: #17351e !important;
    border: 1px solid rgba(255, 255, 255, .78) !important;
    box-shadow:
        0 10px 24px rgba(98, 157, 73, .18),
        inset 0 1px 0 rgba(255, 255, 255, .9) !important;
}

.sidebar .nav a svg,
.sidebar .logout-form svg {
    stroke: #5eac4a !important;
}

.sidebar .nav a:hover,
.sidebar .nav a.active,
.sidebar .logout-form .ghost-button:hover {
    background: linear-gradient(135deg, #ffffff 0%, #e9f99f 100%) !important;
    color: #17351e !important;
    transform: translateX(3px);
}

.sidebar .nav a.active {
    outline: 2px solid rgba(255, 255, 255, .66);
}

.mobile-tabbar {
    background: linear-gradient(135deg, rgba(224, 247, 126, .96), rgba(124, 203, 85, .96)) !important;
    border-color: rgba(255, 255, 255, .72) !important;
}

.mobile-tabbar a,
.mobile-logout button {
    background: linear-gradient(135deg, #ffffff, #f6fce4) !important;
    color: #17351e !important;
    border: 1px solid rgba(255, 255, 255, .8) !important;
    box-shadow: 0 9px 20px rgba(96, 156, 73, .18) !important;
}

.mobile-tabbar a.active,
.mobile-tabbar a:hover,
.mobile-logout button:hover {
    background: linear-gradient(135deg, #ffffff, #e7f88d) !important;
}

/* CRUD modal refinement */
.edit-row.modal-open {
    align-items: center !important;
    justify-items: center !important;
    padding: 18px !important;
    background:
        radial-gradient(circle at 20% 10%, rgba(218, 244, 116, .22), transparent 20rem),
        rgba(42, 76, 34, .34) !important;
}

.edit-row.modal-open td {
    width: min(1040px, 96vw) !important;
    max-height: min(88vh, 820px) !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 24px !important;
    border: 1px solid rgba(255, 255, 255, .76) !important;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .99), rgba(244, 252, 225, .98)) !important;
    box-shadow:
        0 30px 78px rgba(55, 99, 42, .28),
        inset 0 1px 0 rgba(255, 255, 255, .86) !important;
}

.crud-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(231, 248, 141, .92)) !important;
    border-bottom: 1px solid rgba(166, 211, 92, .32);
}

.crud-modal-header span {
    display: block;
    margin-bottom: 3px;
    color: #6d8064;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.crud-modal-header strong {
    display: block;
    color: #2f6f34;
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.1;
}

.modal-close {
    float: none !important;
    width: 42px;
    min-width: 42px;
    height: 42px;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    place-items: center;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #3f8339 !important;
    border: 1px solid rgba(166, 211, 92, .38) !important;
    box-shadow: 0 8px 18px rgba(112, 166, 75, .15) !important;
    font-size: 14px;
    line-height: 1;
}

.edit-row.modal-open .inline-edit-form {
    padding: 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
    background: transparent;
}

.edit-row.modal-open .wide-edit-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.edit-row.modal-open .inline-edit-form input,
.edit-row.modal-open .inline-edit-form select,
.edit-row.modal-open .inline-edit-form textarea {
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(166, 211, 92, .34) !important;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(249, 253, 238, .92)) !important;
    box-shadow:
        inset 2px 2px 5px rgba(112, 166, 75, .07),
        inset -2px -2px 5px rgba(255, 255, 255, .8);
}

.edit-row.modal-open .inline-edit-form textarea {
    grid-column: span 2;
    min-height: 92px;
}

.edit-row.modal-open .inline-edit-form .primary-button {
    min-height: 46px;
    align-self: stretch;
}

.edit-row.modal-open .modal-actions {
    padding: 0 18px 18px;
    justify-content: flex-end;
    border-top: 1px solid rgba(166, 211, 92, .2);
    padding-top: 14px;
}

.edit-row.modal-open .modal-actions::before {
    content: "Zona de acciones";
    margin-right: auto;
    color: #6d8064;
    font-size: 12px;
    font-weight: 900;
}

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

.row-actions form {
    margin: 0;
}

.row-actions .danger-button,
.row-actions .table-action {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
}

@media (max-width: 980px) {
    .edit-row.modal-open .inline-edit-form,
    .edit-row.modal-open .wide-edit-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .edit-row.modal-open {
        padding: 10px !important;
        align-items: end !important;
    }

    .edit-row.modal-open td {
        width: 100% !important;
        max-height: 92vh !important;
        border-radius: 22px 22px 0 0 !important;
    }

    .crud-modal-header {
        padding: 14px;
    }

    .crud-modal-header strong {
        font-size: 18px;
    }

    .edit-row.modal-open .inline-edit-form,
    .edit-row.modal-open .wide-edit-form {
        grid-template-columns: 1fr;
        padding: 14px;
        gap: 10px;
    }

    .edit-row.modal-open .inline-edit-form textarea {
        grid-column: auto;
    }

    .edit-row.modal-open .modal-actions {
        padding: 12px 14px 16px;
        justify-content: stretch;
    }

    .edit-row.modal-open .modal-actions::before {
        width: 100%;
        margin: 0 0 4px;
    }

    .edit-row.modal-open .modal-actions form,
    .edit-row.modal-open .modal-actions .danger-button {
        width: 100%;
    }
}

.filter-count,
.filter-clear {
    align-self: center;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 900;
}

.filter-count {
    color: #4f963c;
    background: rgba(226, 247, 124, .34);
}

.filter-clear {
    border: 1px solid rgba(166, 211, 92, .34);
    background: rgba(255, 255, 255, .82);
    color: #4f963c;
    cursor: pointer;
}

.danger-button,
.danger-button:hover,
button.danger-button[type="submit"],
button.danger-button[type="submit"]:hover {
    background: linear-gradient(135deg, #ffe1dd, #ef7568) !important;
    color: #64190f !important;
    box-shadow: 0 12px 24px rgba(202, 74, 58, .22) !important;
}

/* Flat app surfaces, semantic buttons. Gradients stay only in menu/banner. */
body,
.app-shell,
.content,
.auth-content,
.login-screen,
.auth-box,
.pB,
.mobile-nav {
    background: #f7fbef !important;
}

.panel,
.form-card,
.admin-card,
.table-section,
.work-card,
.dashboard-hero,
.dashboard-metrics article,
.metrics-grid article,
.record-item,
.metric-card,
.order-card,
.edit-row.modal-open td,
.crud-modal-header,
.edit-row.modal-open .inline-edit-form input,
.edit-row.modal-open .inline-edit-form select,
.edit-row.modal-open .inline-edit-form textarea,
input,
select,
textarea,
.search {
    background: #ffffff !important;
}

.admin-card,
.table-section,
.dashboard-hero,
.panel,
.work-card,
.record-item {
    border-color: #dcebc7 !important;
    box-shadow: 0 14px 32px rgba(93, 132, 67, .11) !important;
}

.edit-row.modal-open {
    background: rgba(34, 57, 29, .34) !important;
}

.crud-modal-header {
    border-bottom: 1px solid #dcebc7 !important;
}

.edit-row.modal-open .modal-actions {
    background: #fbfdf7 !important;
}

.primary-button,
.btn-lime,
.admin-card .primary-button,
.table-section .primary-button,
button[type="submit"]:not(.danger-button),
.modal-close {
    background: #cfeea3 !important;
    color: #244a24 !important;
    border: 1px solid #b9df83 !important;
    box-shadow: 0 10px 20px rgba(116, 166, 73, .16) !important;
}

.primary-button:hover,
.btn-lime:hover,
.admin-card .primary-button:hover,
.table-section .primary-button:hover,
button[type="submit"]:not(.danger-button):hover {
    background: #bfe686 !important;
    color: #1f421f !important;
    box-shadow: 0 12px 24px rgba(116, 166, 73, .2) !important;
}

.table-action,
.filter-clear {
    background: #ffe889 !important;
    color: #5b4300 !important;
    border: 1px solid #efd36a !important;
    box-shadow: 0 9px 18px rgba(196, 150, 30, .16) !important;
}

.table-action:hover,
.filter-clear:hover {
    background: #ffdf61 !important;
    color: #4d3900 !important;
}

.danger-button,
.danger-button:hover,
button.danger-button[type="submit"],
button.danger-button[type="submit"]:hover {
    background: #f27a6d !important;
    color: #ffffff !important;
    border: 1px solid #df6659 !important;
    box-shadow: 0 10px 20px rgba(202, 74, 58, .18) !important;
}

.badge,
.filter-count,
.card-heading span {
    background: #e8f5c9 !important;
    color: #3f7534 !important;
    box-shadow: none !important;
}

table tbody tr:not(.edit-row):hover,
.edit-row td {
    background: #f4faea !important;
}

/* Preserve the requested menu/banner treatment. */
.sidebar {
    background:
        linear-gradient(180deg, #ffffff 0 104px, rgba(224, 247, 126, .96) 104px, rgba(143, 215, 89, .98) 56%, rgba(95, 186, 95, .98) 100%) !important;
}

.sidebar-top,
.brand,
.brand-mark {
    background: #ffffff !important;
}

.sidebar .nav a,
.sidebar .logout-form .ghost-button,
.mobile-tabbar a,
.mobile-logout button {
    background: #ffffff !important;
    color: #17351e !important;
    border: 1px solid rgba(255, 255, 255, .8) !important;
    box-shadow: 0 9px 20px rgba(96, 156, 73, .18) !important;
}

.sidebar .nav a:hover,
.sidebar .nav a.active,
.sidebar .logout-form .ghost-button:hover,
.mobile-tabbar a.active,
.mobile-tabbar a:hover,
.mobile-logout button:hover {
    background: #eef9c8 !important;
}

.mobile-tabbar {
    background: linear-gradient(135deg, rgba(224, 247, 126, .96), rgba(124, 203, 85, .96)) !important;
}

/* Mobile recovery: keep the top brand compact and leave navigation only below. */
@media (max-width: 900px) {
    .app-shell:has(.content),
    body.sidebar-collapsed .app-shell:has(.content) {
        display: block !important;
        grid-template-columns: 1fr !important;
        padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    }

    .sidebar,
    body.sidebar-collapsed .sidebar {
        position: sticky !important;
        top: 0 !important;
        z-index: 35 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 10px 12px !important;
        border-radius: 0 0 18px 18px !important;
        background: #ffffff !important;
        box-shadow: 0 8px 24px rgba(76, 120, 50, .14) !important;
    }

    .sidebar-top,
    body.sidebar-collapsed .sidebar-top {
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        justify-content: flex-start !important;
        background: #ffffff !important;
    }

    .brand,
    body.sidebar-collapsed .brand {
        width: 100% !important;
        min-height: 42px !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        background: #ffffff !important;
    }

    .brand-mark {
        width: 42px !important;
        height: 42px !important;
        flex: 0 0 42px !important;
    }

    .brand-text,
    body.sidebar-collapsed .brand-text {
        width: auto !important;
        opacity: 1 !important;
        overflow: visible !important;
        white-space: normal !important;
        color: #17351e !important;
    }

    .brand-text strong,
    .brand-text small {
        color: #17351e !important;
    }

    .sidebar-toggle,
    .sidebar .nav,
    .sidebar .logout-form,
    body.sidebar-collapsed .sidebar-toggle,
    body.sidebar-collapsed .sidebar .nav,
    body.sidebar-collapsed .sidebar .logout-form {
        display: none !important;
    }

    .content {
        padding-top: 12px !important;
    }

    .mobile-tabbar {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        z-index: 70 !important;
        display: flex !important;
        max-width: calc(100vw - 20px) !important;
        overflow-x: auto !important;
    }

    .mobile-tabbar a,
    .mobile-logout,
    .mobile-logout button {
        flex: 0 0 72px !important;
    }
}

/* Mobile CRUD modal: keep actions visible and avoid opening below the fold. */
@media (max-width: 760px) {
    body.crud-modal-active {
        overflow: hidden !important;
    }

    .edit-row.modal-open {
        align-items: center !important;
        justify-items: center !important;
        padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)) !important;
    }

    .edit-row.modal-open td {
        width: min(100%, 430px) !important;
        height: min(88dvh, 680px) !important;
        max-height: min(88dvh, 680px) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        border-radius: 22px !important;
    }

    .crud-modal-header {
        flex: 0 0 auto !important;
        position: relative !important;
        top: auto !important;
    }

    .edit-row.modal-open .inline-edit-form,
    .edit-row.modal-open .wide-edit-form {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        padding-bottom: 16px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .edit-row.modal-open .modal-actions {
        flex: 0 0 auto !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 3 !important;
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 10px 14px calc(12px + env(safe-area-inset-bottom)) !important;
        background: #ffffff !important;
        box-shadow: 0 -10px 24px rgba(72, 110, 48, .12) !important;
    }

    .edit-row.modal-open .modal-actions::before {
        display: none !important;
    }

    .edit-row.modal-open .modal-actions form,
    .edit-row.modal-open .modal-actions button,
    .edit-row.modal-open .modal-actions .primary-button,
    .edit-row.modal-open .modal-actions .danger-button {
        width: 100% !important;
        min-height: 44px !important;
    }
}
