@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@400;500;600;700;800&display=swap');

/* Palette, font and background from Arctic's main page (css/index.css). */
:root {
  color-scheme: light;
  --bg: #fff; --surface: #f8fafce8; --surface-raised: #f8fafc;
  --line: #d7dfe1; --text: #0f1d26; --muted: #64717a;
  --accent: #078ad6; --accent-soft: #078ad610; --input: #edf1f4;
  --button: #0f1d26; --button-text: #f6fdff; --row-hover: #078ad605;
  --danger: #bd4757; --danger-soft: #bd47570c;
}
.dark-theme {
  color-scheme: dark;
  --bg: #080c0e; --surface: #101315e8; --surface-raised: #101315;
  --line: #ffffff0b; --text: #f8feff; --muted: #919b9f;
  --accent-soft: #078ad618; --input: #1b2023;
  --button: #f6fdff; --button-text: #181818; --row-hover: #ffffff03;
  --danger: #e1838e; --danger-soft: #e1838e0c;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; isolation: isolate; background: var(--bg); color: var(--text); font: 13px/1.5 Mulish, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { outline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); }
button { cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; background: var(--button); color: var(--button-text); font-weight: 600; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { background: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: wait; }
button.secondary { background: var(--input); color: var(--muted); }
button.secondary:hover:not(:disabled) { color: var(--text); background: var(--row-hover); border-color: var(--line); }
button.danger { background: var(--danger-soft); color: var(--danger); }
button.danger:hover:not(:disabled) { background: #e1838e18; }
button.primary { background: var(--accent); color: #fff; }
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: radial-gradient(ellipse at 20% 100%, #723bff80, transparent 55%), radial-gradient(ellipse at 85% 100%, #00cadb80, transparent 60%); }
.site-header { width: min(920px, calc(100% - 48px)); height: 56px; margin: 28px auto 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); backdrop-filter: blur(24px); }
.brand { font-weight: 700; font-size: 20px; }
.brand:hover { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 28px; margin-left: 65px; }
.site-nav a { color: var(--muted); font-size: 12px; transition: color .15s; }
.site-nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 11px; }
.theme-toggle { width: 30px; height: 30px; padding: 6px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.theme-toggle:hover:not(:disabled) { background: var(--input); color: var(--text); }
.account-link { border-radius: 7px; background: var(--button); color: var(--button-text); padding: 7px 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.account-link:hover { background: var(--accent); color: #fff; }
.admin-shell { width: min(860px, calc(100% - 48px)); margin: 50px auto 80px; }
.page-heading { text-align: center; margin-bottom: 20px; }
h1 { margin: 0 0 18px; font-size: 32px; line-height: 1.25; font-weight: 800; letter-spacing: -.9px; }
.admin-tabs { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 50px; }
.admin-tabs a { padding: 8px 16px; border-radius: 30px; color: var(--muted); font-size: 12px; line-height: 1.3; transition: color .15s, background .15s; }
.admin-tabs a:hover { color: var(--text); }
.admin-tabs a[aria-current] { color: var(--text); background: var(--input); }
h2 { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 600; }
h3 { margin: 0; font-size: 13px; font-weight: 600; }
p { margin: 0; color: var(--muted); }
.card { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); overflow: hidden; backdrop-filter: blur(20px); }
.card-head { padding: 20px 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head p { margin-top: 4px; font-size: 11px; }
.card-head p:empty { display: none; }
.card-body { padding: 18px 22px; }
.list-card .card-head { padding-bottom: 14px; }
.list-card .card-head h2 { font-size: 12px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 0 22px 10px; }
.toolbar .search-field { flex: 1 1 100%; display: grid; gap: 8px; }
.toolbar .search-field span { font-weight: 500; font-size: 12px; }
.toolbar input { width: 100%; }
.toolbar select { width: auto; min-width: 140px; padding: 6px 10px; font-size: 11px; background: transparent; color: var(--muted); }
.count { margin-left: auto; font-size: 10px; color: var(--muted); }
label { display: grid; gap: 6px; font-size: 11px; color: var(--text); font-weight: 500; }
input, select, textarea { width: 100%; min-width: 0; padding: 8px 11px; border: 1px solid transparent; border-radius: 7px; background: var(--input); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline-offset: 2px; border-color: #078ad660; }
input[readonly] { color: var(--muted); }
textarea { resize: vertical; min-height: 135px; font: 11px/1.8 Consolas, monospace; }
.hint { color: var(--muted); font-size: 10px; font-weight: 400; }
.table-wrap { padding: 0 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 11px; }
th { color: var(--text); font-size: 10px; font-weight: 600; text-align: left; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); }
td { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hover); }
td strong { font-weight: 600; color: var(--text); }
td button { font-size: 10px; padding: 5px 7px; }
td .row-edit { background: transparent; color: var(--muted); padding-right: 0; }
td .row-edit:hover { background: transparent; color: var(--text); }
.user-cell { display: flex; align-items: center; gap: 8px; }
.email-cell { display: block; max-width: 175px; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.group-admin { color: #dd858a; }
.group-owner { color: #b19be9; }
.subscription-active { color: #68b389; }
.muted { font-size: 11px; color: var(--muted); }
.badge { display: inline-block; color: var(--muted); font-size: 10px; font-weight: 500; }
.badge.blue { color: var(--accent); }
.badge.green { color: #68b389; }
.badge.red { color: var(--danger); }
.badge.amber { color: #c8ab77; }
body:not(.dark-theme) .badge.green, body:not(.dark-theme) .subscription-active { color: #28784b; }
body:not(.dark-theme) .group-owner { color: #7959b2; }
body:not(.dark-theme) .group-admin { color: #aa4855; }
.pagination { padding: 12px 22px 17px; display: flex; align-items: center; gap: 5px; }
.pagination button { min-width: 27px; height: 27px; padding: 4px; font-size: 10px; color: var(--muted); background: transparent; }
.pagination button[aria-current] { background: var(--input); color: var(--text); }
.pagination button:disabled { opacity: .3; cursor: default; }
.pagination .page-range { margin-left: auto; font-size: 10px; color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); white-space: normal; font-size: 12px; }
.empty strong { display: block; margin-bottom: 6px; color: var(--text); font-weight: 600; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 4px; color: var(--muted); font-size: 10px; }
.admin-identity { display: flex; align-items: center; gap: 8px; }
#admin-role { opacity: .65; }
.status-dot { width: 4px; height: 4px; background: #68b389; border-radius: 50%; }
.refresh { display: inline-flex; align-items: center; gap: 6px; padding: 5px 0 5px 8px; background: transparent; color: var(--muted); font-size: 10px; }
.refresh:hover:not(:disabled) { background: transparent; color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stat strong { display: block; margin-top: 12px; color: var(--text); font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat p { font-size: 11px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.form-actions button[type=submit], .full-button { width: 100%; }
.quick-durations { display: flex; gap: 6px; margin-top: 8px; }
.quick-durations button { padding: 5px 11px; font-size: 10px; background: var(--input); color: var(--muted); }
.quick-durations button[aria-pressed=true] { background: var(--accent); color: #fff; }
.summary { padding: 9px 0 0; color: var(--muted); font-size: 10px; }
#notice { margin: 0 0 14px; padding: 10px 14px; border: 1px solid #68b38925; border-radius: 10px; background: var(--surface); color: #68b389; font-size: 12px; }
body:not(.dark-theme) #notice:not(.error) { color: #28784b; }
#notice.error, .dialog-error { background: var(--danger-soft); color: var(--danger); border-color: #e1838e25; }
.dialog-error { padding: 9px 11px; border-radius: 7px; margin-bottom: 12px; font-size: 11px; }
dialog { width: min(380px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface-raised); box-shadow: 0 24px 100px #0006; }
dialog::backdrop { background: #04050990; backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; margin: 0; }
.dialog-head h2 { font-size: 13px; }
.icon-button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; font: 21px/1 Arial, sans-serif; color: var(--muted); background: transparent; }
.icon-button:hover:not(:disabled) { background: var(--input); color: var(--text); }
#dialog-body { padding: 0 18px 18px; }
#dialog-body>.muted { margin-bottom: 13px; }
.dialog-fields { display: grid; gap: 12px; }
.section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.section:first-child { padding-top: 0; }
.section:last-child { padding-bottom: 0; border: 0; }
.section h3 { margin-bottom: 10px; }
.section p { margin-bottom: 12px; font-size: 11px; }
.section .form-grid { grid-template-columns: 1fr; }
.subscription-section .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.subscription-section .quick-durations, .subscription-section [data-custom] { grid-column: 1 / -1; }
.section .form-actions button { flex: 1; font-size: 11px; }
.advanced { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.advanced[open] summary { margin-bottom: 14px; color: var(--text); }
.code { font: 10px/1.5 Consolas, monospace; color: var(--muted); }
.details { max-height: 220px; padding: 12px; margin: 8px 0 14px; border-radius: 7px; background: var(--input); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.access { width: min(440px, calc(100% - 48px)); margin: 100px auto; text-align: center; }
.access h2 { margin-bottom: 8px; }
.access a { display: inline-block; margin-top: 20px; color: var(--accent); font-size: 12px; }
.loader { width: 24px; height: 24px; margin: 0 auto 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .site-header { width: calc(100% - 32px); margin-top: 16px; padding: 0 13px; gap: 12px; }
  .site-nav { margin-left: 0; gap: 16px; }
  .admin-shell { width: calc(100% - 32px); margin-top: 40px; }
  .admin-tabs a { padding: 8px 11px; font-size: 11px; }
  h1 { font-size: 28px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .site-header { height: 52px; }
  .site-nav { display: none; }
  .account-link { padding: 7px 10px; }
  .admin-shell { margin-top: 34px; width: calc(100% - 24px); }
  h1 { margin-bottom: 16px; font-size: 27px; }
  .admin-tabs { gap: 0; padding: 4px; width: 100%; max-width: 385px; }
  .admin-tabs a { padding: 8px 9px; font-size: 10px; }
  .card { border-radius: 13px; }
  .card-head { padding: 16px 15px 0; }
  .list-card .card-head { padding-bottom: 12px; }
  .toolbar { padding: 0 15px 10px; }
  .toolbar select { min-width: 125px; }
  body[data-page=users] .toolbar::after { content: 'Прокрутите таблицу →'; color: var(--muted); font-size: 9px; margin-right: auto; order: 1; }
  .table-wrap { padding: 0 6px; }
  body[data-page=users] table { min-width: 710px; }
  th, td { padding: 10px 9px; }
  .pagination { padding: 12px 15px 15px; }
  .page-range { display: none; }
  .panel-footer { padding: 0 2px; }
  #admin-role { display: none; }
  .stat { padding: 17px; }
  .stat strong { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}
