:root {
  --a-bg: #f6f7f9;
  --a-surface: #ffffff;
  --a-surface-2: #fafbfc;
  --a-border: #eaecf0;
  --a-border-strong: #d5d9e0;
  --a-text: #101828;
  --a-text-soft: #667085;
  --a-text-mute: #98a2b3;
  --a-primary: #6d28d9;
  --a-primary-soft: #f2ecfd;
  --a-primary-dark: #5b21b6;
  --a-gold: #b8952a;
  --a-gold-soft: #fdf6e3;
  --a-green: #16a34a;
  --a-green-soft: #dcfce7;
  --a-red: #dc2626;
  --a-red-soft: #fee2e2;
  --a-amber: #d97706;
  --a-amber-soft: #fef3c7;
  --a-radius: 12px;
  --a-radius-sm: 8px;
  --a-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --a-shadow-md: 0 4px 8px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.04);
  --a-shadow-lg: 0 12px 32px -4px rgba(16,24,40,.14);
  --a-sidebar-w: 244px;
  --a-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--a-font); background: var(--a-bg); color: var(--a-text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* Boot */
.a-boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.a-boot__logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--a-primary), var(--a-gold)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 24px; }
.a-boot__spin, .a-spin { width: 28px; height: 28px; border: 3px solid var(--a-border); border-top-color: var(--a-primary); border-radius: 50%; animation: aspin .7s linear infinite; }
@keyframes aspin { to { transform: rotate(360deg); } }

/* Login */
.a-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1d2e 0%, #2d1b4e 100%); padding: 20px; }
.a-login__card { background: var(--a-surface); border-radius: 16px; box-shadow: var(--a-shadow-lg); width: 100%; max-width: 400px; padding: 40px 36px; }
.a-login__brand { text-align: center; margin-bottom: 28px; }
.a-login__logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--a-primary), var(--a-gold)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 24px; margin: 0 auto 14px; }
.a-login__title { font-size: 20px; font-weight: 800; }
.a-login__sub { font-size: 13px; color: var(--a-text-mute); margin-top: 3px; }

/* Shell */
.a-shell { display: flex; min-height: 100vh; }
.a-sidebar { width: var(--a-sidebar-w); background: var(--a-surface); border-right: 1px solid var(--a-border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; transition: transform .25s; }
.a-brand { padding: 20px 20px 16px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--a-border); }
.a-brand__logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--a-primary), var(--a-gold)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.a-brand__name { font-weight: 700; font-size: 15px; }
.a-brand__sub { font-size: 10.5px; color: var(--a-text-mute); text-transform: uppercase; letter-spacing: .06em; }

.a-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.a-nav__group { font-size: 10.5px; font-weight: 600; color: var(--a-text-mute); text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 7px; }
.a-nav__item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--a-radius-sm); color: var(--a-text-soft); font-weight: 500; font-size: 13.5px; margin-bottom: 2px; transition: all .15s; position: relative; cursor: pointer; width: 100%; border: none; background: none; text-align: left; }
.a-nav__item:hover { background: var(--a-surface-2); color: var(--a-text); }
.a-nav__item.is-active { background: var(--a-primary-soft); color: var(--a-primary-dark); font-weight: 600; }
.a-nav__item.is-active::before { content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--a-primary); border-radius: 0 3px 3px 0; }
.a-nav__item i { width: 18px; text-align: center; font-size: 15px; }
.a-nav__badge { margin-left: auto; background: var(--a-red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }

.a-sidebar__foot { padding: 14px; border-top: 1px solid var(--a-border); }
.a-userbox { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--a-radius-sm); }
.a-userbox__av { width: 34px; height: 34px; border-radius: 50%; background: var(--a-primary-soft); color: var(--a-primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.a-userbox__name { font-size: 12.5px; font-weight: 600; }
.a-userbox__role { font-size: 10.5px; color: var(--a-text-mute); text-transform: capitalize; }
.a-userbox__out { margin-left: auto; color: var(--a-text-mute); padding: 6px; border-radius: 6px; cursor: pointer; border: none; background: none; }
.a-userbox__out:hover { background: var(--a-red-soft); color: var(--a-red); }

.a-main { flex: 1; margin-left: var(--a-sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.a-topbar { min-height: 62px; background: var(--a-surface); border-bottom: 1px solid var(--a-border); display: flex; align-items: center; justify-content: space-between; padding: 12px 28px; position: sticky; top: 0; z-index: 30; gap: 12px; }
.a-topbar__title { font-size: 18px; font-weight: 700; }
.a-topbar__crumb { font-size: 12px; color: var(--a-text-mute); }
.a-burger { display: none; width: 40px; height: 40px; border: 1px solid var(--a-border); border-radius: 9px; background: var(--a-surface); cursor: pointer; align-items: center; justify-content: center; font-size: 16px; color: var(--a-text); }

.a-content { padding: 28px; flex: 1; }
.a-content--narrow { max-width: 860px; }

/* Cards */
.a-card { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: var(--a-radius); box-shadow: var(--a-shadow); }
.a-card__head { padding: 18px 24px; border-bottom: 1px solid var(--a-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.a-card__title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.a-card__body { padding: 24px; }

/* Stats */
.a-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 26px; }
.a-stat { background: var(--a-surface); border: 1px solid var(--a-border); border-radius: var(--a-radius); padding: 20px 22px; box-shadow: var(--a-shadow); transition: all .18s; }
.a-stat:hover { box-shadow: var(--a-shadow-md); transform: translateY(-2px); }
.a-stat__icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 16px; }
.a-stat__icon--purple { background: var(--a-primary-soft); color: var(--a-primary); }
.a-stat__icon--gold { background: var(--a-gold-soft); color: var(--a-gold); }
.a-stat__icon--green { background: var(--a-green-soft); color: var(--a-green); }
.a-stat__icon--amber { background: var(--a-amber-soft); color: var(--a-amber); }
.a-stat__value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.a-stat__label { font-size: 12.5px; color: var(--a-text-soft); margin-top: 7px; }

/* Buttons */
.a-btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; padding: 10px 17px; border-radius: var(--a-radius-sm); border: 1px solid transparent; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.a-btn--primary { background: var(--a-primary); color: #fff; box-shadow: 0 1px 2px rgba(109,40,217,.25); }
.a-btn--primary:hover { background: var(--a-primary-dark); box-shadow: 0 4px 12px rgba(109,40,217,.3); transform: translateY(-1px); }
.a-btn--ghost { background: var(--a-surface); border-color: var(--a-border-strong); color: var(--a-text); }
.a-btn--ghost:hover { background: var(--a-surface-2); border-color: var(--a-text-mute); }
.a-btn--danger { background: var(--a-red-soft); color: var(--a-red); }
.a-btn--danger:hover { background: var(--a-red); color: #fff; }
.a-btn--sm { padding: 7px 13px; font-size: 12.5px; }
.a-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Forms */
.a-field { margin-bottom: 20px; }
.a-field__label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.a-field__label span { color: var(--a-red); }
.a-field__hint { font-size: 12px; color: var(--a-text-mute); margin-top: 6px; line-height: 1.5; }
.a-input, .a-select, .a-textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--a-border-strong); border-radius: var(--a-radius-sm); font-family: inherit; font-size: 14px; color: var(--a-text); background: var(--a-surface); transition: all .15s; }
.a-input::placeholder, .a-textarea::placeholder { color: var(--a-text-mute); }
.a-input:hover, .a-select:hover, .a-textarea:hover { border-color: var(--a-text-mute); }
.a-input:focus, .a-select:focus, .a-textarea:focus { outline: none; border-color: var(--a-primary); box-shadow: 0 0 0 3.5px var(--a-primary-soft); }
.a-textarea { resize: vertical; min-height: 90px; }
.a-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d28d9' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px; }
.a-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.a-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Tables */
.a-table-wrap { overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.a-table th { text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 600; color: var(--a-text-mute); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--a-border); background: var(--a-surface-2); white-space: nowrap; }
.a-table td { padding: 13px 16px; border-bottom: 1px solid var(--a-border); }
.a-table tr:last-child td { border-bottom: none; }
.a-table tbody tr:hover { background: var(--a-surface-2); }
.a-table__thumb { width: 40px; height: 56px; border-radius: 5px; object-fit: cover; background: var(--a-bg); border: 1px solid var(--a-border); }
.a-table__noimg { width: 40px; height: 56px; border-radius: 5px; background: var(--a-bg); border: 1px solid var(--a-border); display: flex; align-items: center; justify-content: center; color: var(--a-text-mute); }

/* Badges */
.a-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.a-badge--green { background: var(--a-green-soft); color: var(--a-green); }
.a-badge--red { background: var(--a-red-soft); color: var(--a-red); }
.a-badge--amber { background: var(--a-amber-soft); color: var(--a-amber); }
.a-badge--gray { background: #f0f1f3; color: var(--a-text-soft); }
.a-badge--purple { background: var(--a-primary-soft); color: var(--a-primary-dark); }

/* Alerts */
.a-alert { display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; border-radius: var(--a-radius-sm); font-size: 13.5px; margin-bottom: 20px; }
.a-alert--ok { background: var(--a-green-soft); color: #166534; }
.a-alert--err { background: var(--a-red-soft); color: #991b1b; }
.a-alert--info { background: var(--a-primary-soft); color: var(--a-primary-dark); }
.a-alert ul { margin: 0; padding-left: 16px; }

/* Dropzone */
.a-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 190px; border: 2px dashed var(--a-border-strong); border-radius: var(--a-radius); padding: 28px 20px; text-align: center; cursor: pointer; transition: all .18s; background: var(--a-surface-2); }
.a-drop:hover, .a-drop.is-over { border-color: var(--a-primary); background: var(--a-primary-soft); transform: translateY(-1px); }
.a-drop__ic { width: 52px; height: 52px; border-radius: 50%; background: var(--a-primary-soft); color: var(--a-primary); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 8px; transition: all .18s; }
.a-drop:hover .a-drop__ic, .a-drop.is-over .a-drop__ic { background: #fff; transform: scale(1.05); }
.a-drop__title { font-weight: 600; font-size: 14px; }
.a-drop__hint { font-size: 12px; color: var(--a-text-mute); margin-top: 2px; }
.a-drop__preview { max-width: 130px; max-height: 180px; margin: 0 auto 10px; border-radius: 8px; box-shadow: var(--a-shadow-lg); }
.a-drop--sm { min-height: 150px; padding: 20px; }
.a-drop--sm .a-drop__ic { width: 44px; height: 44px; font-size: 18px; }
.a-drop--sm .a-drop__preview { max-width: 110px; max-height: 110px; }

/* Switch */
.a-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.a-switch input { opacity: 0; width: 0; height: 0; }
.a-switch__slider { position: absolute; inset: 0; background: var(--a-border-strong); border-radius: 999px; cursor: pointer; transition: .2s; }
.a-switch__slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.a-switch input:checked + .a-switch__slider { background: var(--a-green); }
.a-switch input:checked + .a-switch__slider::before { transform: translateX(18px); }

/* Toolbar / misc */
.a-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.a-toolbar__search { flex: 1; min-width: 200px; position: relative; }
.a-toolbar__search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--a-text-mute); font-size: 14px; }
.a-toolbar__search input { padding-left: 38px; }
.a-empty { text-align: center; padding: 50px 20px; color: var(--a-text-mute); }
.a-empty i { font-size: 40px; opacity: .3; margin-bottom: 12px; }
.a-flex { display: flex; align-items: center; gap: 12px; }
.a-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.a-mt { margin-top: 20px; }
.a-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Toasts */
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.a-toast { background: var(--a-surface); border: 1px solid var(--a-border); border-left: 3px solid var(--a-primary); border-radius: var(--a-radius-sm); box-shadow: var(--a-shadow-lg); padding: 13px 16px; font-size: 13.5px; font-weight: 500; min-width: 260px; max-width: 360px; display: flex; align-items: center; gap: 10px; animation: toastIn .25s ease; }
.a-toast--ok { border-left-color: var(--a-green); }
.a-toast--err { border-left-color: var(--a-red); }
.a-toast i { font-size: 16px; }
.a-toast--ok i { color: var(--a-green); }
.a-toast--err i { color: var(--a-red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Modal */
.a-modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.a-modal { background: var(--a-surface); border-radius: var(--a-radius); box-shadow: var(--a-shadow-lg); width: 100%; max-width: 440px; overflow: hidden; }
.a-modal__head { padding: 20px 24px; border-bottom: 1px solid var(--a-border); font-weight: 700; font-size: 16px; }
.a-modal__body { padding: 24px; }
.a-modal__foot { padding: 16px 24px; border-top: 1px solid var(--a-border); display: flex; justify-content: flex-end; gap: 10px; }

.a-drawer-bg { position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 55; }

/* Responsive */
@media (max-width: 900px) {
  .a-sidebar { transform: translateX(-100%); box-shadow: var(--a-shadow-lg); }
  .a-sidebar.is-open { transform: none; }
  .a-main { margin-left: 0; }
  .a-burger { display: flex; }
  .a-grid-2, .a-grid-3 { grid-template-columns: 1fr; }
  .a-content { padding: 18px; }
}
@media (max-width: 560px) {
  .a-topbar { padding: 10px 16px; }
  .a-topbar__title { font-size: 16px; }
  .a-card__body { padding: 18px; }
}
