:root {
    --mysa-burgundy: #5B1527;
    --mysa-burgundy-2: #6A2030;
    --mysa-gold: #C89B45;
    --mysa-gold-2: #D8B06A;
    --mysa-bg: #121212;
    --mysa-panel: #1C1C1C;
    --mysa-card: #242424;
    --mysa-card-2: #2B2B2B;
    --mysa-border: #343434;
    --mysa-border-strong: #4A4A4A;
    --mysa-text: #EAEAEA;
    --mysa-muted: #B8B8B8;
    --mysa-soft: #858585;
    --mysa-danger: #E87A7A;
    --mysa-success: #7BC99E;
    --mysa-warning: #E4B85A;
    --mysa-info: #7BAFE8;
    --mysa-sidebar-width: 280px;
    --mysa-radius-lg: 22px;
    --mysa-radius-md: 16px;
    --mysa-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--mysa-bg); }

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(200, 155, 69, .08), transparent 34rem),
        radial-gradient(circle at top right, rgba(91, 21, 39, .38), transparent 36rem),
        var(--mysa-bg);
    color: var(--mysa-text);
    font-family: Inter, Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.mysa-auth-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

a { color: var(--mysa-gold-2); text-decoration: none; }
a:hover { color: #f0cd86; }

.mysa-app-shell {
    min-height: 100vh;
    display: flex;
}

.mysa-main {
    width: 100%;
    min-width: 0;
    padding: 18px;
    margin-left: var(--mysa-sidebar-width);
}

.mysa-content {
    max-width: 1480px;
    margin: 0 auto;
    padding-bottom: 88px;
}

.mysa-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: var(--mysa-sidebar-width);
    display: flex;
    flex-direction: column;
    background: rgba(28, 28, 28, .86);
    border-right: 1px solid rgba(255, 255, 255, .08);
    backdrop-filter: blur(22px);
    padding: 18px;
}

.mysa-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 8px 8px 18px;
    border-bottom: 1px solid var(--mysa-border);
}

.mysa-logo-mark {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #17120a;
    font-weight: 800;
    letter-spacing: -.04em;
    background: linear-gradient(135deg, var(--mysa-gold), var(--mysa-gold-2));
    box-shadow: 0 0 28px rgba(200, 155, 69, .2);
}

.mysa-brand-name {
    font-weight: 800;
    letter-spacing: .12em;
    color: #fff;
}

.mysa-brand-subtitle {
    color: var(--mysa-muted);
    font-size: 12px;
    margin-top: -2px;
}

.mysa-sidebar-nav {
    display: grid;
    gap: 8px;
    padding: 18px 0;
}

.mysa-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px 13px;
    border-radius: 16px;
    color: var(--mysa-muted);
    border: 1px solid transparent;
    transition: .18s ease;
}

.mysa-nav-link i {
    font-size: 18px;
    color: var(--mysa-gold-2);
}

.mysa-nav-link span {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.mysa-nav-link small {
    color: var(--mysa-soft);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.mysa-nav-link:hover,
.mysa-nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(91, 21, 39, .95), rgba(106, 32, 48, .88));
    border-color: rgba(216, 176, 106, .18);
    box-shadow: 0 16px 42px rgba(91, 21, 39, .25);
}

.mysa-nav-link.disabled {
    opacity: .64;
    cursor: not-allowed;
}

.mysa-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--mysa-border);
    padding-top: 16px;
}

.mysa-user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--mysa-border);
    border-radius: 18px;
    background: rgba(255, 255, 255, .025);
}

.mysa-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #19130a;
    font-weight: 800;
    background: linear-gradient(135deg, var(--mysa-gold), var(--mysa-gold-2));
}

.mysa-user-name {
    font-weight: 700;
    color: #fff;
    font-size: 13px;
}

.mysa-user-role {
    color: var(--mysa-soft);
    font-size: 12px;
}

.mysa-logout-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mysa-muted);
    padding: 12px;
    margin-top: 8px;
    border-radius: 14px;
}

.mysa-logout-link:hover { background: rgba(255,255,255,.04); color: #fff; }

.mysa-sidebar-backdrop { display: none; }

.mysa-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    min-height: 78px;
    margin-bottom: 18px;
    padding: 12px 4px;
    background: linear-gradient(180deg, rgba(18,18,18,.96), rgba(18,18,18,.76));
    backdrop-filter: blur(16px);
}

.mysa-topbar-eyebrow {
    color: var(--mysa-gold-2);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.mysa-topbar-title {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 800;
    letter-spacing: -.04em;
}

.mysa-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mysa-search {
    align-items: center;
    gap: 10px;
    min-width: 330px;
    min-height: 46px;
    padding: 0 14px;
    background: var(--mysa-panel);
    border: 1px solid var(--mysa-border);
    border-radius: 16px;
    color: var(--mysa-muted);
}

.mysa-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--mysa-text);
}

.mysa-search input::placeholder { color: var(--mysa-soft); }

.mysa-icon-btn,
.mysa-scan-btn {
    border: 1px solid rgba(216, 176, 106, .18);
    border-radius: 15px;
    min-height: 46px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255,255,255,.04);
    color: #fff;
}

.mysa-scan-btn {
    background: linear-gradient(135deg, var(--mysa-gold), var(--mysa-gold-2));
    color: #17120a;
    font-weight: 800;
}

.mysa-card {
    background: linear-gradient(180deg, rgba(43,43,43,.96), rgba(36,36,36,.96));
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: var(--mysa-radius-lg);
    box-shadow: 0 18px 55px rgba(0,0,0,.18);
}

.mysa-card-inner { padding: 22px; }

.mysa-hero-card {
    position: relative;
    overflow: hidden;
    min-height: 210px;
    background:
        radial-gradient(circle at 15% 15%, rgba(216,176,106,.18), transparent 20rem),
        linear-gradient(135deg, rgba(91,21,39,.95), rgba(28,28,28,.94));
}

.mysa-hero-card::after {
    content: '';
    position: absolute;
    inset: auto -10% -40% auto;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(200,155,69,.24), transparent 65%);
    pointer-events: none;
}

.mysa-hero-title {
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.02;
    font-weight: 850;
    letter-spacing: -.055em;
}

.mysa-hero-text { color: rgba(234,234,234,.76); max-width: 620px; }

.mysa-metric-card {
    min-height: 158px;
    transition: transform .18s ease, border-color .18s ease;
}

.mysa-metric-card:hover {
    transform: translateY(-2px);
    border-color: rgba(216,176,106,.24);
}

.mysa-metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    color: var(--mysa-gold-2);
    background: rgba(200,155,69,.11);
    border: 1px solid rgba(216,176,106,.18);
}

.mysa-metric-label {
    color: var(--mysa-muted);
    font-size: 13px;
    font-weight: 700;
}

.mysa-metric-value {
    color: #fff;
    font-size: clamp(27px, 6vw, 38px);
    font-weight: 850;
    letter-spacing: -.05em;
}

.mysa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: var(--mysa-gold-2);
    background: rgba(216,176,106,.12);
    border: 1px solid rgba(216,176,106,.2);
}

.mysa-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 18px;
    color: var(--mysa-text);
    border: 1px solid var(--mysa-border);
    border-radius: 20px;
    background: rgba(255,255,255,.025);
    transition: .18s ease;
}

.mysa-action-card:hover {
    color: #fff;
    background: rgba(91,21,39,.32);
    border-color: rgba(216,176,106,.24);
}

.mysa-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(200,155,69,.12);
    color: var(--mysa-gold-2);
    font-size: 20px;
}

.mysa-section-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.02em;
}

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

.mysa-flash {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.1);
}

.mysa-auth-card {
    width: min(100%, 1040px);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 28px;
    background: rgba(28,28,28,.88);
    box-shadow: var(--mysa-shadow);
    backdrop-filter: blur(22px);
}

.mysa-auth-visual {
    position: relative;
    min-height: 650px;
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(circle at 25% 20%, rgba(216,176,106,.22), transparent 18rem),
        linear-gradient(145deg, rgba(91,21,39,.98), rgba(29,15,20,.98));
}

.mysa-auth-pattern {
    position: absolute;
    inset: 0;
    opacity: .13;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,.25) 1px, transparent 1px),
        linear-gradient(-45deg, rgba(255,255,255,.18) 1px, transparent 1px);
    background-size: 34px 34px;
    pointer-events: none;
}

.mysa-auth-visual-content { position: relative; z-index: 1; }

.mysa-auth-title {
    font-size: clamp(32px, 6vw, 58px);
    line-height: .98;
    font-weight: 900;
    letter-spacing: -.065em;
}

.mysa-auth-panel { padding: 46px; display: flex; align-items: center; }
.mysa-auth-form { width: 100%; }

.mysa-form-label {
    color: var(--mysa-muted);
    font-weight: 750;
    font-size: 13px;
    margin-bottom: 8px;
}

.mysa-form-control {
    min-height: 54px;
    border-radius: 16px;
    background: rgba(255,255,255,.045);
    border: 1px solid var(--mysa-border);
    color: var(--mysa-text);
    padding: 12px 15px;
}

.mysa-form-control:focus {
    color: #fff;
    background: rgba(255,255,255,.06);
    border-color: rgba(216,176,106,.45);
    box-shadow: 0 0 0 .25rem rgba(200,155,69,.12);
}

.mysa-btn-primary {
    min-height: 54px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--mysa-burgundy), var(--mysa-burgundy-2));
    color: #fff;
    font-weight: 850;
    box-shadow: 0 20px 45px rgba(91,21,39,.28);
}

.mysa-btn-primary:hover { color: #fff; filter: brightness(1.08); }

.mysa-chart-wrap { height: 310px; }

.mysa-mobile-nav {
    position: fixed;
    z-index: 1050;
    inset: auto 12px 12px 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 24px;
    background: rgba(28,28,28,.92);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0,0,0,.38);
}

.mysa-mobile-nav a {
    min-height: 54px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--mysa-muted);
    font-size: 11px;
    font-weight: 800;
}

.mysa-mobile-nav i { font-size: 18px; }
.mysa-mobile-nav a.active { color: #fff; background: rgba(91,21,39,.56); }
.mysa-mobile-scan { color: #17120a !important; background: linear-gradient(135deg, var(--mysa-gold), var(--mysa-gold-2)); }

@media (max-width: 991.98px) {
    .mysa-main { margin-left: 0; padding: 14px; }
    .mysa-sidebar { transform: translateX(-105%); transition: transform .2s ease; }
    body.sidebar-open .mysa-sidebar { transform: translateX(0); }
    body.sidebar-open .mysa-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(0,0,0,.56);
        backdrop-filter: blur(4px);
    }
    .mysa-topbar { min-height: 66px; margin-bottom: 12px; }
    .mysa-card-inner { padding: 18px; }
}

@media (max-width: 767.98px) {
    body.mysa-auth-body { padding: 14px; place-items: stretch; }
    .mysa-auth-card { grid-template-columns: 1fr; border-radius: 24px; }
    .mysa-auth-visual { min-height: 260px; padding: 26px; }
    .mysa-auth-panel { padding: 26px; }
    .mysa-chart-wrap { height: 260px; }
}

/* ============================================================
   Batch 3 Master CRUD UI
   ============================================================ */
.mysa-nav-group-label {
    margin: 8px 10px 2px;
    color: var(--mysa-soft);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.mysa-page-title {
    color: #fff;
    font-size: clamp(26px, 5vw, 38px);
    font-weight: 900;
    letter-spacing: -.055em;
}

.mysa-btn-gold,
.mysa-btn-ghost,
.mysa-btn-danger {
    min-height: 46px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 850;
}

.mysa-btn-gold {
    border: 0;
    color: #19130a;
    background: linear-gradient(135deg, var(--mysa-gold), var(--mysa-gold-2));
    box-shadow: 0 18px 42px rgba(200, 155, 69, .2);
}

.mysa-btn-gold:hover { color: #19130a; filter: brightness(1.05); }

.mysa-btn-ghost {
    color: var(--mysa-text);
    border: 1px solid var(--mysa-border);
    background: rgba(255, 255, 255, .035);
}

.mysa-btn-ghost:hover {
    color: #fff;
    border-color: rgba(216,176,106,.26);
    background: rgba(91, 21, 39, .25);
}

.mysa-btn-danger {
    color: #fff;
    border: 1px solid rgba(232, 122, 122, .22);
    background: rgba(232, 122, 122, .16);
}

.mysa-btn-danger:hover { color: #fff; background: rgba(232,122,122,.24); }

.mysa-search-inline {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 54px;
    padding: 0 16px;
    background: rgba(255,255,255,.045);
    border: 1px solid var(--mysa-border);
    border-radius: 17px;
    color: var(--mysa-muted);
}

.mysa-search-inline input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--mysa-text);
}

.mysa-search-inline input::placeholder { color: var(--mysa-soft); }

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

.mysa-master-card {
    padding: 18px;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.mysa-master-card:hover {
    transform: translateY(-2px);
    border-color: rgba(216,176,106,.23);
    background: linear-gradient(180deg, rgba(91,21,39,.22), rgba(255,255,255,.025));
}

.mysa-master-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    color: var(--mysa-gold-2);
    background: rgba(200,155,69,.11);
    border: 1px solid rgba(216,176,106,.18);
}

.mysa-master-title {
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    line-height: 1.16;
}

.mysa-master-meta {
    color: var(--mysa-soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    min-height: 18px;
}

.mysa-master-fields {
    display: grid;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.mysa-master-field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--mysa-soft);
    font-size: 12px;
}

.mysa-master-field-row strong {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    color: var(--mysa-muted);
    font-weight: 800;
    text-align: right;
    overflow-wrap: anywhere;
}

.mysa-status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.mysa-status-chip.success {
    color: var(--mysa-success);
    background: rgba(123, 201, 158, .12);
    border: 1px solid rgba(123, 201, 158, .18);
}

.mysa-status-chip.danger {
    color: var(--mysa-danger);
    background: rgba(232, 122, 122, .12);
    border: 1px solid rgba(232, 122, 122, .18);
}

.mysa-status-chip.neutral {
    color: var(--mysa-muted);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
}

.mysa-color-dot {
    width: 18px;
    height: 18px;
    display: inline-block;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}

.mysa-swatch-thumb,
.mysa-swatch-empty {
    width: 48px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.12);
    object-fit: cover;
}

.mysa-swatch-empty {
    display: grid;
    place-items: center;
    color: var(--mysa-soft);
    background: rgba(255,255,255,.04);
}

.mysa-master-form {
    padding: 4px 0;
}

.form-select.mysa-form-control {
    appearance: auto;
}

.mysa-color-input {
    width: 62px;
    height: 54px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--mysa-border);
    background: rgba(255,255,255,.045);
}

.mysa-upload-box {
    padding: 18px;
    border: 1px dashed rgba(216,176,106,.24);
    border-radius: 20px;
    background: rgba(200,155,69,.045);
}

.mysa-upload-hint {
    margin-top: 10px;
    color: var(--mysa-soft);
    font-size: 12px;
}

.mysa-upload-preview {
    margin-top: 14px;
    width: 170px;
    height: 120px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.12);
}

.mysa-empty-state {
    min-height: 300px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 34px 18px;
    color: var(--mysa-muted);
}

.mysa-empty-state i {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 24px;
    color: var(--mysa-gold-2);
    background: rgba(200,155,69,.1);
    border: 1px solid rgba(216,176,106,.18);
    font-size: 32px;
}

.mysa-empty-state h4 {
    color: #fff;
    font-weight: 900;
}

.mysa-empty-state p {
    max-width: 460px;
}

.mysa-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mysa-pagination a {
    min-width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--mysa-muted);
    border: 1px solid var(--mysa-border);
    background: rgba(255,255,255,.035);
    font-weight: 850;
}

.mysa-pagination a.active,
.mysa-pagination a:hover {
    color: #19130a;
    border-color: rgba(216,176,106,.4);
    background: linear-gradient(135deg, var(--mysa-gold), var(--mysa-gold-2));
}

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

@media (max-width: 767.98px) {
    .mysa-master-grid { grid-template-columns: 1fr; }
    .mysa-master-card { padding: 16px; }
    .mysa-btn-gold,
    .mysa-btn-ghost,
    .mysa-btn-danger { width: 100%; }
}
