/* MerryMax — base app shell. Plain CSS, no frameworks. */
:root {
    --brand: #1d6fd1;
    --brand-dark: #164f96;
    --bg: #f2f5f9;
    --card: #ffffff;
    --text: #1e2a38;
    --muted: #6b7a8c;
    --border: #dde4ec;
    --danger: #c0392b;
    --success: #1e8e4e;
    --radius: 10px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }

/* Sidebar — light Vuexy-style vertical menu: icons, accordion groups,
   gradient active pill, self-scrolling nav area. */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fa 100%);
    border-right: 1px solid var(--border);
    color: #4b5563;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}
.sidebar .brand {
    padding: 16px 16px 12px;
    flex-shrink: 0;
}

/* ---------- MerryMax brand lockup ---------- */
.mm-brand { display: flex; align-items: center; gap: 10px; }
.mm-brand-icon { flex-shrink: 0; }
.mm-brand-sidebar .mm-brand-icon { width: 44px; height: 36px; object-fit: contain; }
.mm-brand-name {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #1b2a5e; /* deep navy from the logo */
    line-height: 1.1;
}
.mm-brand-name span {
    background: linear-gradient(120deg, #16a34a, #7cc61b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.mm-brand-store { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 1px; }

/* Big version for login/signup */
.mm-brand-auth { flex-direction: column; text-align: center; gap: 8px; }
.mm-brand-auth .mm-brand-icon { width: 90px; height: 74px; object-fit: contain; }
.mm-brand-auth .mm-brand-name { font-size: 34px; }
.mm-brand-sub {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .22em;
    color: #44506b;
    margin-top: 3px;
}
.mm-brand-tagline { font-size: 13px; color: var(--muted); margin-top: 6px; }
.mm-brand-tagline .mm-blue { color: #1d4ed8; }
.mm-brand-tagline .mm-green { color: #16a34a; }

.sidebar .nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 12px 12px;
    scrollbar-width: thin;
    scrollbar-color: #d3dce6 transparent;
}
.sidebar .nav-scroll::-webkit-scrollbar { width: 5px; }
.sidebar .nav-scroll::-webkit-scrollbar-thumb { background: #c3d2e2; border-radius: 4px; }
.sidebar .nav-scroll::-webkit-scrollbar-track { background: transparent; }

/* Shared row style for top links, group toggles and the logout button */
.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 12px;
    margin: 2px 0;
    border: none;
    border-radius: 8px;
    background: none;
    color: #4b5563;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.sidebar .nav-item:hover { background: #e3ecf6; text-decoration: none; color: #1e2a38; }
.sidebar .nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.sidebar .nav-item span:not(.dot) { flex: 1; }

/* Active top-level link: brand gradient pill */
.sidebar .nav-item.active {
    background: linear-gradient(118deg, var(--brand), #4a92e6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(29, 111, 209, .35);
}
.sidebar .nav-item.active:hover { color: #fff; }

/* Group toggle chevron */
.sidebar .nav-toggle .chev {
    width: 15px;
    height: 15px;
    flex: none;
    color: #9aa7b8;
    transform: rotate(90deg);
    transition: transform .18s;
}
.sidebar .nav-group.collapsed .chev { transform: rotate(0deg); }
.sidebar .nav-group.collapsed .nav-links { display: none; }
.sidebar .nav-toggle.parent-active { color: #1e2a38; font-weight: 600; }

/* Submenu entries: plain indented links aligned under the parent label */
.sidebar .nav-sub {
    display: flex;
    align-items: center;
    padding: 8px 12px 8px 42px;
    margin: 1px 0;
    border-radius: 8px;
    color: #5b6b7c;
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.sidebar .nav-sub:hover { background: #e3ecf6; color: #1e2a38; text-decoration: none; }
.sidebar .nav-sub.active {
    background: linear-gradient(118deg, var(--brand), #4a92e6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(29, 111, 209, .35);
}

.sidebar .sidebar-foot {
    flex-shrink: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
}
.sidebar .logout-btn { color: var(--danger); }
.sidebar .logout-btn:hover { background: #fdeae7; color: var(--danger); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 10px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.content { padding: 22px; }

/* Impersonation banner */
.impersonate-banner {
    background: #b7791f;
    color: #fff;
    padding: 7px 22px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.impersonate-banner form { margin: 0; }

/* ---------- Cards / tables / forms ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table tr:hover td { background: #f8fafc; }

.btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(29,111,209,.12);
}

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: #e2f5ea; color: var(--success); }
.badge-red { background: #fdeae7; color: var(--danger); }
.badge-gray { background: #edf1f5; color: var(--muted); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #e2f5ea; color: #166437; }
.alert-error { background: #fdeae7; color: #922b21; }

.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #14273e 0%, #1d6fd1 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 34px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.login-card .logo { font-size: 21px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.login-card .logo span { color: var(--brand); }
.login-card .tagline { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; padding: 10px; font-size: 14.5px; }

/* Pagination (default Laravel links) */
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; }

/* ---------- Dashboard ---------- */
.badge-amber { background: #fdf3e0; color: #b45309; }

.dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.dash-kpi {
    border-radius: 14px;
    padding: 16px 18px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(23, 43, 99, .16);
}
.kpi-blue  { background: linear-gradient(128deg, #2b7fff, #1d4ed8); }
.kpi-green { background: linear-gradient(128deg, #16a34a, #4dab27); }
.kpi-amber { background: linear-gradient(128deg, #f59e0b, #d97706); }
.kpi-rose  { background: linear-gradient(128deg, #f43f5e, #be123c); }
.kpi-head { display: flex; justify-content: space-between; align-items: center; }
.kpi-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; opacity: .92; }
.kpi-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .18);
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-value { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -.01em; }
.kpi-foot { font-size: 12px; margin-top: 5px; opacity: .95; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi-foot a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.kpi-delta {
    background: rgba(255, 255, 255, .2);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

.dash-row { display: grid; gap: 14px; margin-bottom: 16px; align-items: stretch; }
.dash-row-chart  { grid-template-columns: 1.9fr 1fr; }
.dash-row-mid    { grid-template-columns: 1.4fr 1fr; }
.dash-row-bottom { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) {
    .dash-row-chart, .dash-row-mid, .dash-row-bottom { grid-template-columns: 1fr; }
}
.dash-card { margin-bottom: 0; }
.dash-card-head {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 10px; margin-bottom: 12px;
}
.dash-card-head h2 { margin: 0; }
.dash-more { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
a.dash-more { color: var(--brand); }

.dash-trend { width: 100%; height: auto; display: block; }
.dash-axis { font-size: 10px; fill: #8a94a6; }
.dash-empty-text { font-size: 13px; fill: #8a94a6; }

.dash-donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dash-donut { width: 150px; height: 150px; flex-shrink: 0; }
.dash-donut-total { font-size: 17px; font-weight: 800; fill: #1c2430; }
.dash-donut-sub { font-size: 9.5px; fill: #8a94a6; letter-spacing: .05em; }
.dash-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 8px; }
.dash-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dash-legend-row .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dash-legend-row .lbl { flex: 1; color: #3c4657; }
.dash-legend-row .amt { font-weight: 600; }
.dash-legend-row .pc { color: var(--muted); width: 34px; text-align: right; }

.dash-table td, .dash-table th { padding-top: 8px; padding-bottom: 8px; }

.dash-bar-row { margin-bottom: 11px; }
.dash-bar-row:last-child { margin-bottom: 0; }
.dash-bar-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 4px; }
.dash-bar-meta .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-meta .vl { white-space: nowrap; }
.dash-bar-track { height: 8px; border-radius: 6px; background: #eef2f7; overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 6px; }
.fill-0 { background: linear-gradient(90deg, #2b7fff, #4a92e6); }
.fill-1 { background: linear-gradient(90deg, #16a34a, #7cc61b); }
.fill-2 { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.fill-3 { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.fill-4 { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.dash-stat {
    background: #f6f9fd;
    border: 1px solid #e6edf5;
    border-radius: 10px;
    padding: 10px 13px;
    display: flex; flex-direction: column; gap: 3px;
}
.dash-stat .s-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dash-stat .s-value { font-size: 17px; font-weight: 700; }

.dash-counters { display: flex; flex-direction: column; gap: 8px; }
.dash-counter {
    display: flex; align-items: center; gap: 10px;
    background: #f6f9fd; border: 1px solid #e6edf5;
    border-radius: 10px; padding: 9px 13px;
}
.dash-counter .cc {
    background: linear-gradient(118deg, var(--brand), #4a92e6);
    color: #fff; font-weight: 700; font-size: 12px;
    border-radius: 7px; padding: 3px 9px;
}
.dash-counter .cn { flex: 1; font-size: 13.5px; font-weight: 500; }

/* ---------- Auth: compact signup + password eye toggle ---------- */
.signup-card { max-width: 700px !important; padding: 26px 34px 24px; }
.signup-card .mm-brand-auth .mm-brand-icon { width: 62px; height: 52px; }
.signup-card .mm-brand-auth .mm-brand-name { font-size: 26px; }
.signup-card .mm-brand-auth { gap: 4px; }
.signup-card .mm-brand-tagline { margin-top: 2px; }
.signup-card .tagline { margin-bottom: 14px; }
.signup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 0;
}
.signup-card .field { margin-bottom: 11px; }
.signup-card .field label { margin-bottom: 3px; }
.signup-card .btn { margin-top: 4px; }
@media (max-width: 640px) {
    .signup-grid { grid-template-columns: 1fr; }
}
@media (max-height: 800px) {
    .signup-card .mm-brand-sub, .signup-card .mm-brand-tagline { display: none; }
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px !important; }
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    padding: 5px;
    color: var(--muted);
    display: flex;
    align-items: center;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; }

/* ---------- Pagination ---------- */
.pagination-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; font-size: 13.5px; }
.pg-btn {
    display: inline-block;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
}
a.pg-btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pg-active { background: linear-gradient(118deg, var(--brand), #4a92e6); border-color: var(--brand); color: #fff; font-weight: 700; }
.pg-disabled { color: #b6c2cf; background: #f7fafc; }
.pg-dots { color: var(--muted); padding: 0 2px; }
.pg-info { color: var(--muted); margin-left: 6px; font-size: 12.5px; }
