/* admin.css — Miniartura operator console.
   Reuses the brand tokens from styles.css; adds a console shell,
   KPI cards, charts, table, catalog editors, moderation grid. */

.admin { }
/* the [hidden] attribute must win over display:grid set on these containers */
.login[hidden], .console[hidden], .drawer[hidden] { display: none !important; }

/* ============ LOGIN ============ */
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card { background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 34px 30px 26px; animation: viewIn .4s ease both; }
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login__title { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.5px; }
.login__sub { color: var(--ink-mute); font-weight: 700; font-size: 13px; }
.login__status { color: var(--ink-soft); font-weight: 700; line-height: 1.5; margin: 8px 0 18px; }
.login__field { display: block; margin-bottom: 14px; }
.login__field span { display: block; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; }
.login__field input { width: 100%; font-family: var(--font-body); font-weight: 700; font-size: 15px; color: var(--ink); background: var(--bg-2); border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 12px 14px; outline: none; }
.login__field input:focus { border-color: var(--accent); }
.login__error { color: var(--accent); font-weight: 700; font-size: 13px; margin: 2px 0 12px; }
.login__btn { width: 100%; justify-content: center; margin-top: 6px; }
.login__demo { margin-top: 20px; padding: 14px 16px; background: var(--bg-2); border-radius: var(--radius-md); font-weight: 600; font-size: 13px; color: var(--ink-soft); text-align: center; }
.login__demo strong { display: block; font-family: var(--font-display); color: var(--ink); margin-bottom: 6px; }
.login__demo code { background: #fff; padding: 2px 8px; border-radius: 6px; font-family: ui-monospace, monospace; color: var(--accent); font-weight: 700; }
.login__fill { display: block; width: 100%; margin-top: 12px; border: 0; cursor: pointer; background: var(--ink); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 13px; padding: 10px; border-radius: var(--radius-sm); }
.login__back { display: block; text-align: center; margin-top: 18px; color: var(--ink-mute); font-weight: 700; font-size: 13px; text-decoration: none; }
.login__back:hover { color: var(--ink); }

/* ============ CONSOLE SHELL ============ */
.console { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 6px; padding: 22px 16px;
  background: rgba(255,255,255,0.7); backdrop-filter: blur(14px); border-right: 1px solid rgba(43,37,64,0.07);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 6px 8px 16px; }
.sidebar__name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.5px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar__link {
  display: flex; align-items: center; gap: 11px; text-align: left; width: 100%;
  border: 0; background: transparent; cursor: pointer; font-family: var(--font-body); font-weight: 700; font-size: 14px; color: var(--ink-soft);
  padding: 11px 12px; border-radius: var(--radius-sm); transition: all .15s ease;
}
.sidebar__link span:first-child { width: 20px; text-align: center; }
.sidebar__link:hover { background: var(--bg-2); color: var(--ink); }
.sidebar__link.is-active { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar__badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; }
.sidebar__link.is-active .sidebar__badge { background: #fff; color: var(--accent); }
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid rgba(43,37,64,0.07); }
.sidebar__back { display: block; text-align: left; border: 0; background: transparent; cursor: pointer; color: var(--ink-mute); font-family: var(--font-body); font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; }
.sidebar__back:hover { background: var(--bg-2); color: var(--ink); }

.main { min-width: 0; padding: 0 clamp(16px, 3vw, 32px) 60px; }
.main__bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 18px 0; background: rgba(254,246,240,0.82); backdrop-filter: blur(10px); }
.main__menu { display: none; border: 0; background: var(--card); cursor: pointer; font-size: 18px; width: 40px; height: 40px; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.main__title { font-family: var(--font-display); font-weight: 700; font-size: 26px; margin: 0; letter-spacing: -0.5px; }
.main__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.main__who { color: var(--ink-mute); font-weight: 700; font-size: 13px; }

.section { display: none; animation: viewIn .35s ease both; }
.section.is-active { display: block; }

/* ============ KPI CARDS ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,0.8); }
.kpi__label { color: var(--ink-mute); font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.kpi__num { font-family: var(--font-display); font-weight: 700; font-size: 30px; letter-spacing: -1px; margin: 8px 0 4px; }
.kpi__delta { font-weight: 800; font-size: 13px; }
.kpi__delta.up { color: #08744d; }
.kpi__delta.down { color: var(--accent); }

/* ============ PANELS ============ */
.panel { background: var(--card); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,0.8); margin-bottom: 18px; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel__title { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0; }
.panel__hint { color: var(--ink-mute); font-weight: 700; font-size: 12px; }
.panel-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }

/* bar chart */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.chart__bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart__fill { width: 100%; max-width: 30px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); transition: height .6s cubic-bezier(.34,1.56,.64,1); min-height: 4px; }
.chart__val { font-weight: 800; font-size: 12px; color: var(--ink-soft); }
.chart__lbl { font-size: 10px; color: var(--ink-mute); font-weight: 700; }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { flex: 0 0 auto; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend__row { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.donut-legend__sw { width: 12px; height: 12px; border-radius: 4px; }
.donut-legend__row b { color: var(--ink); }

/* recent list */
.recent-list { display: flex; flex-direction: column; }
.recent-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid rgba(43,37,64,0.06); }
.recent-row:last-child { border-bottom: 0; }
.recent-row__av { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-blue)); flex: 0 0 auto; }
.recent-row__name { font-weight: 800; font-size: 14px; }
.recent-row__email { color: var(--ink-mute); font-weight: 600; font-size: 12px; }
.recent-row__meta { margin-left: auto; text-align: right; }
.recent-row__when { color: var(--ink-mute); font-weight: 700; font-size: 12px; }

/* ============ TOOLBAR ============ */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar__search { flex: 1; min-width: 200px; font-family: var(--font-body); font-weight: 700; font-size: 14px; color: var(--ink); background: var(--card); border: 1.5px solid rgba(43,37,64,0.1); border-radius: 999px; padding: 11px 18px; outline: none; box-shadow: var(--shadow-sm); }
.toolbar__search:focus { border-color: var(--accent); }
.toolbar__filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fbtn { border: 1.5px solid rgba(43,37,64,0.1); background: var(--card); cursor: pointer; font-family: var(--font-body); font-weight: 700; font-size: 13px; color: var(--ink-soft); padding: 9px 15px; border-radius: 999px; transition: all .15s ease; }
.fbtn:hover { border-color: var(--accent); }
.fbtn.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ TABLE ============ */
.table-wrap { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,0.8); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--font-body); font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-mute); padding: 14px 16px; border-bottom: 1px solid rgba(43,37,64,0.08); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table th.actions-col { text-align: right; }
.table td { padding: 13px 16px; border-bottom: 1px solid rgba(43,37,64,0.05); font-weight: 700; font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--bg-2); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user__av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-blue)); flex: 0 0 auto; }
.cell-user__name { font-weight: 800; }
.cell-user__email { color: var(--ink-mute); font-weight: 600; font-size: 12px; }
.cell-creation__art { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex: 0 0 auto; background: var(--bg-2); display: grid; place-items: center; }
.cell-creation__art svg { width: 100%; height: 100%; display: block; }
.badge { display: inline-block; font-family: var(--font-display); font-weight: 600; font-size: 12px; padding: 4px 11px; border-radius: 999px; background: var(--bg-2); color: var(--ink-soft); }
.badge--Free { background: var(--bg-2); color: var(--ink-soft); }
.badge--Pro { background: var(--pastel-blue); color: var(--accent-3); }
.badge--Studio { background: var(--pastel-pink); color: var(--accent); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; }
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.active { color: #08744d; }
.status-dot.active::before { background: #08744d; }
.status-dot.suspended { color: var(--accent); }
.status-dot.suspended::before { background: var(--accent); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.iconbtn { border: 1.5px solid rgba(43,37,64,0.1); background: var(--card); cursor: pointer; font-family: var(--font-body); font-weight: 700; font-size: 12px; color: var(--ink-soft); padding: 7px 12px; border-radius: var(--radius-sm); transition: all .15s ease; white-space: nowrap; }
.iconbtn:hover { border-color: var(--accent); color: var(--ink); }
.iconbtn--danger:hover { border-color: var(--accent); color: var(--accent); }
.iconbtn--ok:hover { border-color: #08744d; color: #08744d; }
.table-empty { text-align: center; padding: 40px 20px; color: var(--ink-mute); font-weight: 700; }

/* ============ CATALOG ============ */
.catalog-list { display: flex; flex-direction: column; gap: 10px; }
.catalog-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg-2); border-radius: var(--radius-md); }
.catalog-row__emoji { font-size: 24px; }
.catalog-row__name { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.catalog-row__key { color: var(--ink-mute); font-weight: 700; font-size: 12px; }
.catalog-row__state { margin-left: auto; font-weight: 800; font-size: 13px; color: var(--ink-mute); }
.catalog-row__state.on { color: #08744d; }
/* toggle switch */
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; background: rgba(43,37,64,0.18); border-radius: 999px; transition: background .2s ease; }
.switch__thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.switch input:checked ~ .switch__track { background: #08744d; }
.switch input:checked ~ .switch__thumb { transform: translateX(20px); }

.pack-admin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pack-edit { border: 1.5px solid rgba(43,37,64,0.1); border-radius: var(--radius-lg); padding: 16px; }
.pack-edit__name { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.pack-edit__tag { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pack-edit__field { display: block; margin-bottom: 10px; }
.pack-edit__field span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 4px; }
.pack-edit__field input { width: 100%; font-family: var(--font-body); font-weight: 700; font-size: 15px; color: var(--ink); background: var(--bg-2); border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 9px 12px; outline: none; }
.pack-edit__field input:focus { border-color: var(--accent); }
.pack-edit__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.pack-edit__per { color: var(--ink-mute); font-weight: 700; font-size: 12px; }

/* ============ MODERATION ============ */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.mod-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,0.8); overflow: hidden; display: flex; flex-direction: column; }
.mod-card.is-resolved { opacity: .55; }
.mod-card__art { line-height: 0; }
.mod-card__art .fig-svg { width: 100%; height: auto; display: block; }
.mod-card__body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mod-card__prompt { font-weight: 700; font-size: 13px; line-height: 1.35; color: var(--ink); }
.mod-card__meta { color: var(--ink-mute); font-weight: 700; font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mod-card__reports { color: var(--accent); }
.mod-card__actions { display: flex; gap: 8px; margin-top: auto; }
.mod-card__actions .iconbtn { flex: 1; text-align: center; }
.mod-card__verdict { margin-top: auto; font-weight: 800; font-size: 13px; padding: 8px 0; text-align: center; }
.mod-card__verdict.approved { color: #08744d; }
.mod-card__verdict.rejected { color: var(--accent); }

/* ============ DRAWER ============ */
.drawer { position: fixed; inset: 0; z-index: 200; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(30,22,46,0.5); backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s ease; }
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer__panel { position: absolute; top: 0; right: 0; height: 100%; width: min(420px, 92vw); background: var(--card); box-shadow: var(--shadow-lg); padding: 30px 28px; overflow-y: auto; transform: translateX(100%); transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.drawer__avatar { width: 56px; height: 56px; font-size: 26px; border-radius: 18px; }
.drawer__name { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin: 0; letter-spacing: -0.5px; }
.drawer__email { color: var(--ink-mute); font-weight: 700; font-size: 13px; }
.drawer__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.drawer__stat { background: var(--bg-2); border-radius: var(--radius-md); padding: 14px; }
.drawer__stat-num { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.5px; }
.drawer__stat-lbl { color: var(--ink-mute); font-weight: 700; font-size: 12px; margin-top: 2px; }
.drawer__section { margin-bottom: 20px; }
.drawer__label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.seg--inline { display: inline-flex; }
.seg--inline .seg__btn { padding: 8px 16px; }
.grant-row { display: flex; gap: 8px; }
.grant-row .btn-soft { flex: 1; justify-content: center; }
.drawer__actions { margin-top: 26px; }
.drawer__actions .btn-ghost { width: 100%; justify-content: center; }
.drawer__actions .btn-ghost.is-danger { background: var(--accent); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1080px) {
  .panel-row { grid-template-columns: 1fr; }
  .pack-admin { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .console { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 80; width: 260px; transform: translateX(-100%); transition: transform .3s ease; }
  .console.menu-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main__menu { display: grid; place-items: center; }
  /* mobile: show users as cards instead of a wide table */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid rgba(43,37,64,0.08); }
  .table td { border: 0; padding: 4px 0; }
  .table td.num { text-align: left; }
  .table td[data-label]::before { content: attr(data-label) ': '; color: var(--ink-mute); font-weight: 800; font-size: 12px; text-transform: uppercase; }
  .table td.cell-user-td::before { display: none; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 8px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .main__who { display: none; }
}
