@import 'tailwindcss';

@source '../views/**/*.blade.php';
@source '../js/**/*.js';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';

@theme {
    --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
        'Segoe UI Symbol', 'Noto Color Emoji';
}

:root {
    color-scheme: light;
    --bg: #eef3f7;
    --surface: #ffffff;
    --surface-soft: #f7fafc;
    --surface-strong: #edf4f2;
    --ink: #17212b;
    --muted: #718096;
    --line: #dce6ee;
    --primary: #3157d5;
    --primary-dark: #243c9d;
    --teal: #0f9f8f;
    --coral: #f16b5b;
    --amber: #efb326;
    --violet: #7b61ff;
    --shadow: 0 18px 42px rgb(39 55 77 / 12%);
    --sidebar: #263b8f;
    --sidebar-deep: #17276c;
}

[data-theme='dark'] {
    color-scheme: dark;
    --bg: #101820;
    --surface: #17212b;
    --surface-soft: #1d2a35;
    --surface-strong: #213540;
    --ink: #edf5f3;
    --muted: #a6b5c2;
    --line: #314454;
    --primary: #7b96ff;
    --primary-dark: #9cb0ff;
    --teal: #24c5b4;
    --coral: #ff8a78;
    --amber: #f2c85b;
    --violet: #a18cff;
    --shadow: 0 18px 42px rgb(0 0 0 / 28%);
    --sidebar: #15245f;
    --sidebar-deep: #0e1845;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    letter-spacing: 0;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.boot-screen,
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.boot-screen {
    grid-template-columns: auto auto;
    gap: 14px;
    color: var(--ink);
}

.boot-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.boot-copy {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.login-card {
    width: min(980px, 100%);
    min-height: 600px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-art {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px;
    color: white;
    background:
        linear-gradient(135deg, rgb(38 59 143 / 94%), rgb(15 159 143 / 84%)),
        url("data:image/svg+xml,%3Csvg width='900' height='640' viewBox='0 0 900 640' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,.25)' stroke-width='2'%3E%3Cpath d='M80 120h250c45 0 75 30 75 75v250c0 45 30 75 75 75h280'/%3E%3Cpath d='M60 420h190c30 0 52-20 52-50V170c0-36 28-65 65-65h415'/%3E%3Cpath d='M114 530h166c40 0 70-30 70-70V285c0-42 34-76 76-76h316'/%3E%3C/g%3E%3Cg fill='rgba(255,255,255,.86)'%3E%3Crect x='112' y='92' width='88' height='54' rx='8'/%3E%3Crect x='656' y='132' width='116' height='70' rx='8'/%3E%3Crect x='546' y='426' width='148' height='82' rx='8'/%3E%3Ccircle cx='362' cy='228' r='34'/%3E%3Ccircle cx='248' cy='430' r='24'/%3E%3C/g%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
}

.login-art h1 {
    max-width: 440px;
    margin: 0;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 0.96;
    font-weight: 850;
}

.login-art p {
    max-width: 440px;
    margin: 18px 0 0;
    color: rgb(255 255 255 / 82%);
}

.login-form {
    padding: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.field {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.field label,
.mini-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    padding: 0 12px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.textarea {
    min-height: 88px;
    padding: 10px 12px;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgb(49 87 213 / 14%);
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    color: white;
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-deep));
    box-shadow: 8px 0 28px rgb(23 39 108 / 20%);
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 16px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--coral), var(--amber));
    color: white;
    font-weight: 900;
    box-shadow: 0 10px 28px rgb(0 0 0 / 18%);
}

.brand-name {
    margin: 0;
    font-size: 18px;
    font-weight: 850;
    line-height: 1;
}

.brand-sub {
    margin: 3px 0 0;
    color: rgb(255 255 255 / 65%);
    font-size: 11px;
    font-weight: 700;
}

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

.nav-button {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0 12px;
    border-radius: 8px;
    color: rgb(255 255 255 / 74%);
    font-size: 14px;
    font-weight: 750;
    text-align: left;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button:hover,
.nav-button.is-active {
    color: white;
    background: rgb(255 255 255 / 13%);
}

.nav-button.is-active {
    box-shadow: inset 3px 0 0 rgb(255 255 255 / 82%);
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px 8px;
    color: rgb(255 255 255 / 70%);
    font-size: 12px;
}

.main-shell {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    background: rgb(238 243 247 / 86%);
    border-bottom: 1px solid rgb(220 230 238 / 70%);
    backdrop-filter: blur(16px);
}

[data-theme='dark'] .topbar {
    background: rgb(16 24 32 / 86%);
    border-bottom-color: rgb(49 68 84 / 80%);
}

.mobile-menu {
    display: none;
}

.search-box {
    width: min(460px, 42vw);
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.search-box input {
    width: 100%;
    outline: none;
    color: var(--ink);
}

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Subtle background-sync indicator shown in topbar */
.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    border-radius: 20px;
    padding: 4px 10px;
    animation: fadeIn 200ms ease;
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}


.icon-btn,
.mini-icon-btn {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-btn {
    width: 42px;
    height: 42px;
}

.mini-icon-btn {
    width: 32px;
    height: 32px;
}

.icon-btn:hover,
.mini-icon-btn:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--teal));
}

.content {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px;
}

.view-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.page-title {
    margin: 0;
    font-size: clamp(24px, 3.2vw, 34px);
    line-height: 1.05;
    font-weight: 880;
}

.page-copy {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.grid-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
}

.primary-grid {
    display: grid;
    gap: 18px;
}

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

.metric-card,
.panel,
.side-card,
.table-shell,
.form-panel,
.toast {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 26px rgb(39 55 77 / 8%);
}

.metric-card {
    min-height: 118px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.metric-kicker {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-value {
    margin: 8px 0 0;
    font-size: 28px;
    line-height: 1;
    font-weight: 900;
}

.metric-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: white;
}

.tone-blue {
    background: var(--primary);
}

.tone-teal {
    background: var(--teal);
}

.tone-coral {
    background: var(--coral);
}

.tone-amber {
    background: var(--amber);
}

.tone-violet {
    background: var(--violet);
}

.panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 850;
}

.panel-subtitle {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.chart-wrap {
    height: 238px;
    display: grid;
    align-items: end;
}

.spark-chart {
    width: 100%;
    height: 220px;
}

.chart-grid {
    stroke: color-mix(in srgb, var(--line) 68%, transparent);
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line-alt {
    stroke: var(--teal);
}

.chart-area {
    fill: color-mix(in srgb, var(--primary) 14%, transparent);
}

.bars {
    display: grid;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) 70px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.bar-track {
    height: 10px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface-strong);
}

.bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--teal), var(--primary));
}

.side-rail {
    display: grid;
    gap: 14px;
    align-content: start;
}

.side-card {
    padding: 16px;
}

.status-list,
.activity-list {
    display: grid;
    gap: 12px;
}

.status-item,
.activity-item,
.product-pick {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--teal);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--teal) 14%, transparent);
}

.status-dot.warn {
    background: var(--amber);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--amber) 18%, transparent);
}

.pill,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.pill {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--muted);
}

.badge {
    min-height: 24px;
    padding: 0 9px;
}

.badge.success {
    color: #08766b;
    background: #ddf8f3;
}

.badge.warn {
    color: #855d00;
    background: #fff3cf;
}

.badge.danger {
    color: #a53a2c;
    background: #ffe5e1;
}

.badge.info {
    color: var(--primary-dark);
    background: color-mix(in srgb, var(--primary) 12%, white);
}

[data-theme='dark'] .badge.info {
    background: color-mix(in srgb, var(--primary) 24%, transparent);
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 18px;
}

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

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

.table-shell {
    overflow: hidden;
}

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

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

.data-table th,
.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 13px;
}

.data-table th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

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

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

.money {
    font-variant-numeric: tabular-nums;
    font-weight: 850;
}

.module-row,
.settings-row {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.module-row:last-child,
.settings-row:last-child {
    border-bottom: 0;
}

.switch {
    width: 46px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: var(--line);
    transition: background 160ms ease;
}

.switch span {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: white;
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    transition: transform 160ms ease;
}

.switch.is-on {
    background: var(--teal);
}

.switch.is-on span {
    transform: translateX(20px);
}

.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 850;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    box-shadow: 0 12px 28px rgb(49 87 213 / 20%);
}

.btn-ghost {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.btn-danger {
    color: white;
    background: var(--coral);
}

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

.form-panel {
    padding: 18px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.product-tile {
    min-height: 132px;
    display: grid;
    gap: 10px;
    align-content: space-between;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    text-align: left;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.product-tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
    box-shadow: 0 16px 28px rgb(39 55 77 / 10%);
}

.product-thumb,
.activity-avatar {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: white;
    font-size: 13px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--teal), var(--primary));
}

.cart-list {
    display: grid;
    gap: 10px;
}

.cart-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px 32px;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.cart-item:last-child {
    border-bottom: 0;
}

.empty-state {
    min-height: 110px;
    display: grid;
    place-items: center;
    padding: 18px;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    text-align: center;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 80;
    width: min(380px, calc(100vw - 32px));
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow);
}

.toast-mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: white;
    background: var(--teal);
    flex: 0 0 auto;
}

.loading-mask {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgb(238 243 247 / 48%);
    backdrop-filter: blur(2px);
    z-index: 70;
}

[data-theme='dark'] .loading-mask {
    background: rgb(16 24 32 / 54%);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid color-mix(in srgb, var(--primary) 18%, transparent);
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.icon-sm {
    width: 15px;
    height: 15px;
}

@media (max-width: 1200px) {
    .grid-dashboard {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 260px;
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

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

    .mobile-menu {
        display: inline-grid;
    }

    .search-box {
        width: min(100%, 360px);
    }

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

    .login-card {
        grid-template-columns: 1fr;
    }

    .login-art {
        min-height: 320px;
    }
}

@media (max-width: 720px) {
    .content {
        padding: 16px;
    }

    .topbar {
        padding: 12px 14px;
        flex-wrap: wrap;
    }

    .search-box {
        order: 3;
        width: 100%;
    }

    .metric-grid,
    .side-rail,
    .three-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .view-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .login-form,
    .login-art {
        padding: 26px;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}
