:root {
    --white: #ffffff;
    --surface: #f6fbf8;
    --surface-2: #eef8f2;
    --green: #16a34a;
    --green-dark: #0f5132;
    --green-deep: #063f2a;
    --yellow: #facc15;
    --gold: #eab308;
    --blue: #0ea5e9;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --danger: #ef4444;
    --shadow: 0 24px 70px rgba(15, 81, 50, 0.14);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(250, 204, 21, 0.16), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.16), transparent 26rem),
        var(--surface);
}

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

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

.auth-shell {
    display: grid;
    grid-template-columns: minmax(320px, 480px) minmax(360px, 1fr);
    gap: 3rem;
    min-height: 100vh;
    align-items: center;
    padding: clamp(1.25rem, 3vw, 4rem);
    overflow: hidden;
}

.auth-card,
.panel-card,
.metric-card,
.floating-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card {
    padding: clamp(1.5rem, 4vw, 2.4rem);
}

.installer-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1rem;
}

.installer-card {
    width: min(100%, 520px);
}

.brand-mark,
.sidebar-brand,
.user-chip,
.customer-row,
.inventory-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-drop,
.metric-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 16px;
    color: var(--white);
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    box-shadow: 0 12px 26px rgba(22, 163, 74, 0.24);
}

.brand-mark strong,
.sidebar-brand strong {
    display: block;
    color: var(--green-dark);
    font-size: 1.08rem;
}

.brand-mark small,
.sidebar-brand small,
.topbar-title small,
.user-chip small,
.panel-head p,
.customer-row small,
.inventory-item small {
    color: var(--muted);
}

.auth-copy {
    margin: 2.5rem 0 1.5rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-copy h1,
.hero-panel h1 {
    margin: 0.5rem 0 0.8rem;
    color: #0b3022;
    font-size: clamp(2rem, 5vw, 3.8rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

.auth-copy p,
.hero-panel p {
    max-width: 42rem;
    color: var(--muted);
    line-height: 1.7;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-form label {
    display: grid;
    gap: 0.5rem;
    color: #374151;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus {
    border-color: rgba(22, 163, 74, 0.65);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 0;
    border-radius: 16px;
    padding: 0.85rem 1.15rem;
    font-weight: 800;
    cursor: pointer;
}

.btn-primary {
    color: var(--white);
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    box-shadow: 0 18px 34px rgba(15, 81, 50, 0.26);
}

.btn-accent {
    color: #1f2937;
    background: linear-gradient(135deg, var(--yellow), var(--gold));
    box-shadow: 0 18px 34px rgba(234, 179, 8, 0.24);
}

.btn-full {
    width: 100%;
}

.alert {
    margin-bottom: 1rem;
    border-radius: 16px;
    padding: 0.9rem 1rem;
    font-weight: 700;
}

.alert-error {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.alert-success {
    color: #14532d;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
}

.auth-preview {
    position: relative;
    min-height: 620px;
}

.floating-card {
    position: absolute;
    padding: 1.2rem;
    backdrop-filter: blur(18px);
}

.preview-main {
    inset: 8% 6% auto 8%;
    min-height: 360px;
}

.preview-side {
    right: 2%;
    bottom: 15%;
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.preview-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.preview-top span {
    color: var(--muted);
    font-weight: 700;
}

.preview-top strong {
    color: var(--green-dark);
    font-size: 2.2rem;
}

.preview-chart {
    display: flex;
    align-items: end;
    gap: 1rem;
    height: 230px;
    margin-top: 2rem;
    padding: 1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.08), rgba(14, 165, 233, 0.08));
}

.preview-chart i,
.line-chart span {
    display: block;
    width: 100%;
    border-radius: 999px 999px 12px 12px;
    background: linear-gradient(180deg, var(--green), var(--green-dark));
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 99px;
    background: var(--green);
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.12);
}

.auto-orb {
    position: absolute;
    width: 360px;
    height: 360px;
    right: 7%;
    top: 22%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), transparent 18%),
        linear-gradient(135deg, rgba(14, 165, 233, 0.45), rgba(22, 163, 74, 0.35));
    filter: blur(1px);
    z-index: -1;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.3rem;
    color: var(--white);
    background: linear-gradient(180deg, var(--green-dark), #062a1e);
}

.sidebar-brand {
    margin-bottom: 2rem;
}

.sidebar .brand-drop {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.sidebar-brand strong,
.sidebar-brand small {
    color: var(--white);
}

.side-nav {
    display: grid;
    gap: 0.45rem;
}

.side-nav a {
    border-radius: 16px;
    padding: 0.95rem 1rem;
    color: rgba(255, 255, 255, 0.74);
    font-weight: 750;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.side-nav a:hover,
.side-nav a.is-active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.14);
    transform: translateX(3px);
}

.sidebar-footer {
    position: absolute;
    right: 1.3rem;
    bottom: 1.3rem;
    left: 1.3rem;
    border-radius: 18px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer small {
    display: block;
    color: rgba(255, 255, 255, 0.65);
}

.main-panel {
    min-width: 0;
    padding: 1.3rem clamp(1rem, 2.5vw, 2rem) 2rem;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -1.3rem calc(clamp(1rem, 2.5vw, 2rem) * -1) 1.3rem;
    padding: 1rem clamp(1rem, 2.5vw, 2rem);
    background: rgba(246, 251, 248, 0.86);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.topbar-title strong {
    display: block;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
    cursor: pointer;
}

.js-menu {
    display: none;
}

.avatar {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 14px;
    color: var(--white);
    background: linear-gradient(135deg, var(--green), var(--blue));
    font-size: 0.86rem;
    font-weight: 900;
}

.logout-link,
.text-link {
    color: var(--green-dark);
    font-weight: 800;
}

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    margin-bottom: 1.2rem;
    border-radius: 30px;
    padding: clamp(1.2rem, 3vw, 2rem);
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(246, 251, 248, 0.9)),
        radial-gradient(circle at 85% 20%, rgba(250, 204, 21, 0.3), transparent 16rem);
    box-shadow: var(--shadow);
}

.hero-panel h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
}

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

.metric-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    box-shadow: 0 14px 38px rgba(15, 81, 50, 0.08);
}

.metric-card p {
    margin: 0 0 0.25rem;
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 750;
}

.metric-card strong {
    display: block;
    color: #0b3022;
    font-size: 1.45rem;
}

.metric-card small {
    color: var(--green);
    font-weight: 800;
}

.metric-yellow .metric-icon {
    color: #3f2a02;
    background: linear-gradient(135deg, var(--yellow), var(--gold));
}

.metric-blue .metric-icon {
    background: linear-gradient(135deg, var(--blue), #2563eb);
}

.metric-warning .metric-icon {
    color: #3f2a02;
    background: linear-gradient(135deg, var(--yellow), var(--gold));
}

.metric-emerald .metric-icon {
    background: linear-gradient(135deg, var(--green-dark), var(--green));
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.span-2 {
    grid-column: span 2;
}

.panel-card {
    padding: 1rem;
    box-shadow: 0 14px 38px rgba(15, 81, 50, 0.08);
}

.panel-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-head h2 {
    margin: 0 0 0.25rem;
    color: #0b3022;
    font-size: 1.04rem;
}

.panel-head p {
    margin: 0;
    font-size: 0.86rem;
}

.line-chart {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    min-height: 210px;
    padding: 1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.08), rgba(14, 165, 233, 0.05));
}

.line-chart span {
    background: linear-gradient(180deg, var(--green), rgba(22, 163, 74, 0.36));
}

.inventory-list,
.customer-list {
    display: grid;
    gap: 0.75rem;
}

.inventory-item,
.customer-row {
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.85rem;
    background: var(--white);
}

.inventory-item strong,
.customer-row strong {
    display: block;
}

.pill-dot {
    width: 12px;
    height: 42px;
    border-radius: 999px;
    background: var(--green);
}

.pill-dot.blue {
    background: var(--blue);
}

.pill-dot.yellow {
    background: var(--gold);
}

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

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

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.9rem 0.7rem;
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tr.row-hover,
.data-table tbody tr:hover {
    background: rgba(22, 163, 74, 0.06);
}

.status-badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    color: var(--green-dark);
    background: rgba(22, 163, 74, 0.12);
    font-size: 0.78rem;
    font-weight: 850;
}

.status-badge.inactive {
    color: #64748b;
    background: #f1f5f9;
}

.status-badge.active {
    color: var(--green-dark);
    background: rgba(22, 163, 74, 0.12);
}

.status-badge.pending {
    color: #854d0e;
    background: rgba(250, 204, 21, 0.18);
}

.status-badge.preparing,
.status-badge.route,
.status-badge.confirmed {
    color: #075985;
    background: rgba(14, 165, 233, 0.14);
}

.status-badge.delivered,
.status-badge.paid,
.status-badge.completed,
.status-badge.done,
.status-badge.sent,
.status-badge.success,
.status-badge.info {
    color: #14532d;
    background: rgba(22, 163, 74, 0.14);
}

.status-badge.cancelled,
.status-badge.rejected,
.status-badge.failed,
.status-badge.blocked,
.status-badge.critical {
    color: #991b1b;
    background: #fef2f2;
}

.status-badge.credit,
.status-badge.draft,
.status-badge.ready,
.status-badge.scheduled,
.status-badge.trial,
.status-badge.past_due {
    color: #713f12;
    background: rgba(234, 179, 8, 0.16);
}

.status-badge.paused,
.status-badge.warning,
.status-badge.deleted {
    color: #475569;
    background: #f1f5f9;
}

.status-badge.authorized {
    color: #14532d;
    background: rgba(22, 163, 74, 0.14);
}

.customer-row b {
    color: var(--green-dark);
}

.mobile-nav {
    display: none;
}

.hero-compact h1 {
    font-size: clamp(2rem, 3.4vw, 2.9rem);
}

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

.module-grid {
    display: grid;
    grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.form-card {
    position: sticky;
    top: 92px;
}

.list-card {
    min-width: 0;
}

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

.module-form label,
.search-form {
    display: grid;
    gap: 0.45rem;
}

.module-form label span {
    color: #374151;
    font-size: 0.84rem;
    font-weight: 800;
}

.module-form label small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.switch-field {
    display: flex !important;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.9rem;
    background: #f8fafc;
}

.switch-field input {
    width: 18px !important;
    height: 18px;
    flex: 0 0 auto;
    margin-top: 0.15rem;
    accent-color: var(--green);
}

.switch-field span {
    color: #334155;
    line-height: 1.5;
}

.module-form input,
.module-form select,
.module-form textarea,
.search-form input,
.search-form select,
.status-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 0.85rem 0.9rem;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.module-form textarea {
    resize: vertical;
}

.module-form input:focus,
.module-form select:focus,
.module-form textarea:focus,
.search-form input:focus,
.search-form select:focus,
.status-form select:focus {
    border-color: rgba(22, 163, 74, 0.65);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.full-field {
    grid-column: 1 / -1;
}

.panel-head-stack {
    align-items: stretch;
}

.search-form {
    grid-template-columns: minmax(180px, 1fr) auto;
    min-width: min(100%, 420px);
}

.table-person {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-person strong,
.table-person small {
    display: block;
}

.table-person small {
    max-width: 260px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.row-actions form {
    margin: 0;
}

.mini-link,
.mini-button {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 81, 50, 0.14);
    border-radius: 12px;
    padding: 0.35rem 0.6rem;
    color: var(--green-dark);
    background: var(--white);
    font-size: 0.78rem;
    font-weight: 850;
    cursor: pointer;
}

.mini-button {
    color: #6b4e00;
    background: rgba(250, 204, 21, 0.14);
}

.empty-table {
    color: var(--muted);
    text-align: center !important;
}

.product-dot {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    background: rgba(14, 165, 233, 0.12);
}

.product-dot.warning {
    background: rgba(250, 204, 21, 0.22);
}

.block-gap {
    margin-top: 1.3rem;
}

.item-builder {
    display: grid;
    gap: 0.65rem;
}

.item-builder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #374151;
    font-size: 0.84rem;
    font-weight: 800;
}

.sale-items {
    display: grid;
    gap: 0.65rem;
}

.sale-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px auto;
    gap: 0.5rem;
    align-items: center;
}

.total-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px;
    padding: 1rem;
    color: var(--green-dark);
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.12), rgba(250, 204, 21, 0.16));
}

.total-box span {
    font-weight: 850;
}

.total-box strong {
    font-size: 1.45rem;
}

.order-list {
    display: grid;
    gap: 0.8rem;
}

.order-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 1rem;
    background: var(--white);
}

.order-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.order-main p {
    margin: 0.25rem 0;
    color: #0b3022;
    font-weight: 800;
}

.order-main small {
    color: var(--muted);
}

.order-total {
    display: grid;
    justify-items: end;
    gap: 0.4rem;
}

.order-total strong {
    color: var(--green-dark);
    font-size: 1.1rem;
}

.order-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.85rem 0;
}

.order-items span {
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    color: #334155;
    background: #f1f5f9;
    font-size: 0.78rem;
    font-weight: 800;
}

.status-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: 22px;
    padding: 1.3rem;
    color: var(--muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.65);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.detail-box,
.timeline-card,
.evidence-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.85rem;
    background: var(--white);
}

.detail-box span,
.timeline-card small,
.evidence-card small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.detail-box strong,
.timeline-card strong,
.evidence-card strong {
    display: block;
    color: #0b3022;
    margin-top: 0.2rem;
}

.timeline-list,
.evidence-list,
.history-list {
    display: grid;
    gap: 0.75rem;
}

.timeline-card p,
.evidence-card p {
    margin: 0.45rem 0 0;
    color: #475569;
    line-height: 1.55;
}

.timeline-card-head,
.history-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.history-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 1rem;
    background: var(--white);
}

.history-card h3 {
    margin: 0.15rem 0 0.25rem;
    color: #0b3022;
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.8rem;
}

.history-meta span {
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    color: #334155;
    background: #f1f5f9;
    font-size: 0.78rem;
    font-weight: 800;
}

.print-body {
    background: #f3f4f6;
}

.print-page {
    max-width: 920px;
    margin: 2rem auto;
    border-radius: 28px;
    padding: clamp(1rem, 3vw, 2rem);
    background: var(--white);
    box-shadow: var(--shadow);
}

.print-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1rem;
}

.print-header h1 {
    margin: 0.35rem 0;
    color: #0b3022;
    font-size: clamp(2rem, 4vw, 3rem);
}

.print-header p,
.print-section p {
    margin: 0.25rem 0;
    color: #475569;
}

.print-section {
    margin-top: 1.2rem;
}

.print-section h2 {
    color: #0b3022;
    font-size: 1.05rem;
}

.print-signatures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.print-signatures div {
    border-top: 1px solid #111827;
    padding-top: 0.5rem;
    text-align: center;
}

.portal-shell {
    display: grid;
    gap: 1rem;
    width: min(100% - 2rem, 980px);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem) 0;
}

.portal-card {
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 28px;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.portal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.portal-header h1,
.portal-card h2 {
    margin: 0.25rem 0;
    color: #0b3022;
}

.portal-header p,
.portal-card p {
    color: #475569;
}

.portal-search {
    align-items: end;
}

.message-preview {
    margin-bottom: 1rem;
}

.message-preview textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem;
    color: #334155;
    background: #f8fafc;
    resize: vertical;
}

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

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

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

    .form-card {
        position: static;
    }
}

@media (max-width: 860px) {
    .auth-shell {
        display: block;
        padding: 1rem;
    }

    .auth-preview {
        display: none;
    }

    .auth-card {
        min-height: calc(100vh - 2rem);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .app-shell {
        display: block;
        padding-bottom: 78px;
    }

    .sidebar {
        position: fixed;
        z-index: 60;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        transform: translateX(-110%);
        transition: transform 0.22s ease;
        box-shadow: 28px 0 80px rgba(0, 0, 0, 0.25);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-panel {
        padding: 1rem;
    }

    .topbar {
        margin: -1rem -1rem 1rem;
        padding: 0.85rem 1rem;
    }

    .js-menu {
        display: grid;
    }

    .topbar-actions .user-chip,
    .logout-link {
        display: none;
    }

    .hero-panel {
        display: grid;
        border-radius: 24px;
    }

    .hero-panel .btn {
        width: 100%;
    }

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

    .compact-metrics {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

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

    .panel-head-stack {
        display: grid;
    }

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

    .sale-item,
    .status-form {
        grid-template-columns: 1fr;
    }

    .order-main,
    .total-box,
    .timeline-card-head,
    .history-card-head {
        display: grid;
        justify-items: stretch;
    }

    .order-total {
        justify-items: start;
    }

    .search-form .btn {
        width: 100%;
    }

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

    .mobile-nav {
        position: fixed;
        z-index: 50;
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.2rem;
        border: 1px solid rgba(229, 231, 235, 0.9);
        border-radius: 24px;
        padding: 0.45rem;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 22px 60px rgba(15, 81, 50, 0.2);
        backdrop-filter: blur(18px);
    }

    .mobile-nav a {
        display: grid;
        place-items: center;
        gap: 0.15rem;
        border-radius: 18px;
        padding: 0.45rem 0.2rem;
        color: var(--muted);
        font-size: 0.7rem;
        font-weight: 850;
    }

    .mobile-nav a span {
        font-size: 1.1rem;
    }

    .mobile-nav a.is-active {
        color: var(--white);
        background: linear-gradient(135deg, var(--green-dark), var(--green));
    }

    .portal-header {
        align-items: flex-start;
    }
}

@media print {
    body {
        background: #fff !important;
    }

    .sidebar,
    .mobile-nav,
    .topbar,
    .print-hide,
    .hero-panel .btn,
    .logout-link {
        display: none !important;
    }

    .app-shell,
    .main-panel {
        display: block;
        padding: 0;
        min-height: auto;
    }

    .hero-panel,
    .panel-card,
    .metric-card,
    .history-card,
    .print-page {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .print-page {
        max-width: none;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .data-table {
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .auth-copy h1 {
        font-size: 2.25rem;
    }

    .metric-card {
        align-items: flex-start;
    }

    .metric-card strong {
        font-size: 1.25rem;
    }

    .row-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .mini-link,
    .mini-button {
        width: 100%;
    }
}
