:root {
  --bg:        #080808;
  --bg-1:      #0d0d0d;
  --bg-2:      #131313;
  --bg-3:      #1a1a1a;
  --bg-4:      #222222;
  --card:      #131313;
  --border:    #1e1e1e;
  --border-2:  #2a2a2a;
  --text:      #f0f0f0;
  --text-2:    #8c8c8c;
  --text-3:    #555555;
  --accent:    #e8ff47;
  --accent-dim:#c8dc30;
  --green:     #4ade80;
  --red:       #f87171;
  --amber:     #fbbf24;
  --blue:      #60a5fa;
  --danger:    #f87171;
  --radius:    6px;
  --radius-lg: 10px;
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

#app { max-width: 900px; margin: 0 auto; padding: 16px; }

.screen { display: flex; flex-direction: column; gap: 16px; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.card h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }

.badge {
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.active { background: var(--accent); color: #000; border-color: var(--accent); }
.badge.success { background: #10b981; color: #fff; border-color: #10b981; }
.badge.warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.badge.danger { background: #ef4444; color: #fff; border-color: #ef4444; }

.mobile-nav-toggle {
  display: none;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
}

.mobile-nav-overlay.open { display: block; }

.mobile-nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.mobile-nav-panel.open { transform: translateX(0); }

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}

.mobile-nav-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
}

.mobile-nav-list .tab-btn {
  text-align: left;
  justify-content: flex-start;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); background: var(--bg-2); }

.tab-btn.active {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border-2);
}

.tab-content { display: none; padding: 16px 0; }
.tab-content.active { display: block; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

/* Templates list */
.templates-list { display: flex; flex-direction: column; gap: 10px; }

.template-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.template-card:hover { border-color: var(--border-2); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

.template-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }

.template-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.template-title-row .title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-badge {
  color: #000;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}

.template-actions { display: flex; gap: 8px; flex-shrink: 0; }

.template-actions .btn { min-height: 36px; }

/* Mobile */
@media (max-width: 480px) {
  .template-card { flex-direction: column; align-items: stretch; padding: 14px; gap: 10px; }
  .template-title-row .title { white-space: normal; overflow: visible; }
  .template-actions { width: 100%; }
  .template-actions .btn { flex: 1; min-height: 44px; }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .template-card { padding: 14px; gap: 10px; }
  .template-title-row .title { max-width: 200px; }
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-2); }

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 16px; height: 16px; color: var(--text-2); }

.stat-body { flex: 1; }

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.list { display: flex; flex-direction: column; gap: 8px; }

.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item .info { display: flex; flex-direction: column; gap: 4px; }
.item .title { font-weight: 600; }
.item .meta { font-size: 12px; color: var(--text-2); }

.btn {
  background: rgba(232, 255, 71, 0.12);
  color: var(--accent);
  border: 1px solid rgba(232, 255, 71, 0.35);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  white-space: nowrap;
}

.btn:hover {
  background: rgba(232, 255, 71, 0.22);
  border-color: rgba(232, 255, 71, 0.55);
  color: #eaff60;
}

.btn:active {
  background: rgba(232, 255, 71, 0.08);
  border-color: rgba(232, 255, 71, 0.25);
  transform: scale(0.97);
}

.btn.secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
  border: 1px solid var(--border-2);
}

.btn.secondary:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: var(--border);
}

.btn.secondary:active {
  background: rgba(255,255,255,0.02);
}

.btn.small { padding: 6px 12px; font-size: 12px; }

.btn.danger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.btn.danger:hover {
  background: rgba(248, 113, 113, 0.22);
  border-color: rgba(248, 113, 113, 0.55);
}

.btn.danger:active {
  background: rgba(248, 113, 113, 0.08);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
  transition: all var(--transition);
}
.chip:hover { border-color: rgba(232, 255, 71, 0.45); color: var(--text); }
.chip.active {
  background: rgba(232, 255, 71, 0.14);
  color: var(--accent);
  border-color: rgba(232, 255, 71, 0.45);
}

.section {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 { font-size: 14px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; }

.section-body { padding: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.form-group label { font-size: 12px; color: var(--text-2); font-weight: 500; }

.form-group small { font-size: 11px; color: var(--text-3); }

input, textarea, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}

input:focus, textarea:focus, select:focus { border-color: var(--border-2); }

.readonly {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

/* Styled file input */
.file-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.file-input-wrapper:hover { border-color: var(--border-2); }
.file-input-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-input-icon {
  color: var(--text-2);
  flex-shrink: 0;
}
.file-input-text {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-input-text.has-file { color: var(--text); }

/* Resource chips for multi-select */
.resource-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.resource-chip:hover { border-color: var(--accent-dim); }
.resource-chip.selected {
  background: rgba(232, 255, 71, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.resource-chip .chip-remove {
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
}
.resource-chip .chip-remove:hover { opacity: 1; }

/* Usage badge */
.usage-badge {
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-3);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(20px) scale(0.98); }
}

@keyframes modal-sheet-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal.hidden { display: none; }

.modal:not(.hidden) .modal-content {
  animation: modal-in 0.25s cubic-bezier(0.22,1,0.36,1) forwards;
}

.modal-content {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-2);
  margin: 8px auto 0;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 14px; font-weight: 600; }

.modal-body { padding: 20px; }

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn-close:hover { background: var(--bg-3); color: var(--text); }

.status { font-size: 12px; margin-top: 8px; }
.status.ok { color: var(--green); }
.status.err { color: var(--red); }

.admin-only { display: none; }
.admin-only.visible { display: inline-block; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }

th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); font-weight: 600; }

tr:hover td { background: var(--bg-2); }

tbody tr:last-child td { border-bottom: none; }

/* Login Screen */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  animation: fadeInUp 0.5s ease-out;
}

.login-card.admin { border-color: var(--red); }
.login-card.admin .login-icon { background: rgba(248,113,113,0.15); color: var(--red); }

.login-icon {
  width: 56px;
  height: 56px;
  background: rgba(232,255,71,0.12);
  color: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 20px;
}

.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.02em; }

.login-desc { color: var(--text-2); font-size: 13px; margin-bottom: 24px; line-height: 1.5; }

.auth-state { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-state.hidden { display: none !important; }

#telegram-login { display: flex; justify-content: center; width: 100%; }

.telegram-oidc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #2AABEE;
  color: #fff !important;
  border: none;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius);
  width: 100%;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
}
.telegram-oidc-btn:hover { background: #229ED9; transform: translateY(-1px); }
.telegram-oidc-btn:active { background: #1A8BC4; transform: translateY(0); }

.btn-full { width: 100%; text-align: center; justify-content: center; }

.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-or { color: var(--text-3); font-size: 12px; margin: 4px 0; }

/* File input styling */
input[type="file"] { width: 100%; }

/* Checkbox styling */
input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin-right: 8px;
}

.hint { font-size: 11px; color: var(--text-3); margin-top: 4px; line-height: 1.4; }

/* Worker controls */
.item .btn.small { padding: 6px 12px; font-size: 12px; }

/* Analytics modal */
#analytics-modal .modal-content { max-width: 520px; }

#analytics-modal .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

#analytics-modal .card { padding: 14px; text-align: center; }

#analytics-modal .card .title { font-size: 22px; font-weight: 700; color: var(--accent); }

#analytics-modal .card .meta { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* Blocked page */
.blocked-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.blocked-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.blocked-card .icon {
  width: 56px; height: 56px;
  background: rgba(248,113,113,0.12);
  color: var(--red);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}

.blocked-card h1 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }

.blocked-card p { color: var(--text-2); font-size: 13px; line-height: 1.6; margin-bottom: 6px; }

.blocked-card .meta { color: var(--text-3); font-size: 11px; margin-top: 16px; }

/* Analytics */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 16px; }
.analytics-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.analytics-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 14px; color: var(--text-2); }
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-3); font-size: 13px; }
.engagement-row { margin-bottom: 14px; }
.engagement-row .label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.engagement-row .bar-bg { background: var(--bg-3); height: 6px; border-radius: 3px; overflow: hidden; }
.engagement-row .bar-fill { height: 100%; border-radius: 3px; }

/* Collapsible request sections */
.chevron { transition: transform var(--transition); }
.chevron.collapsed { transform: rotate(-90deg); }

/* ─── Mobile App View ─── */
@media (max-width: 768px) {
  #app { padding: 10px; }

  .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .desktop-tabs { display: none; }

  header { padding: 8px 0; gap: 8px; }
  header h1 { font-size: 17px; }

  .badge { padding: 3px 8px; font-size: 10px; }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)) !important;
    gap: 5px;
  }

  .stat-card {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 2px;
    gap: 4px;
    text-align: center;
    border-radius: 8px;
  }

  .stat-icon { width: 26px; height: 26px; }
  .stat-icon svg { width: 13px; height: 13px; }
  .stat-body { flex: none; }
  .stat-value { font-size: 15px; font-weight: 700; }
  .stat-label { display: none; }

  .section { margin-bottom: 10px; border-radius: 10px; }
  .section-head { padding: 10px 12px; }
  .section-head h2 { font-size: 12px; }
  .section-body { padding: 10px; }

  .list { gap: 6px; }

  .item {
    padding: 10px 12px;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .item .title { font-size: 13px; }
  .item .meta { font-size: 11px; }

  .btn { min-height: 44px; padding: 10px 14px; font-size: 12px; }
  .btn.small { min-height: 36px; padding: 6px 10px; font-size: 11px; }

  input, textarea, select {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .form-group { gap: 4px; margin-bottom: 10px; }
  .form-group label { font-size: 11px; }

  .chip { padding: 4px 10px; font-size: 11px; }

  .file-input-wrapper { padding: 6px 10px; }
  .file-input-icon { width: 16px; height: 16px; }
  .file-input-text { font-size: 12px; }

  .tab-content { padding: 10px 0; }

  .templates-list { gap: 8px; }
  .template-card { padding: 12px; gap: 8px; }
  .template-title-row .title { font-size: 13px; }
  .template-badge { font-size: 9px; padding: 1px 5px; }
  .template-actions { gap: 6px; }
  .template-actions .btn { min-height: 36px; }

  .analytics-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
    margin-bottom: 10px;
  }

  .analytics-card {
    padding: 12px;
    border-radius: 8px;
  }

  .analytics-card h3 { font-size: 12px; margin-bottom: 10px; }

  table { font-size: 11px; }
  th, td { padding: 7px 8px; }
  th { font-size: 10px; }

  .empty-state { padding: 20px 12px; font-size: 12px; }

  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 88vh;
    animation: modal-sheet-in 0.3s cubic-bezier(0.22,1,0.36,1) forwards;
  }

  .modal-handle { display: block; }

  .modal-header { padding: 10px 16px 12px; }
  .modal-header h3 { font-size: 15px; }

  .modal-body { padding: 12px 16px 14px; }
  .modal-body .form-group { margin-bottom: 10px; }
  .modal-body .form-group label { font-size: 11px; }
  .modal-body input, .modal-body select, .modal-body textarea {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .modal-body .hint { font-size: 10px; }
  .modal-body .resource-chips { gap: 5px; margin-top: 4px; }
  .modal-body .resource-chip { font-size: 11px; padding: 3px 8px; }

  .modal-actions {
    padding: 10px 16px;
    gap: 8px;
  }
  .modal-actions .btn { flex: 1; justify-content: center; }

  .hint { font-size: 10px; }

  .usage-badge { font-size: 10px; padding: 2px 6px; }

  .resource-chip { font-size: 11px; padding: 3px 8px; }

  /* Uploads tab: stack the two upload cards */
  #uploads-tab .analytics-grid { grid-template-columns: 1fr !important; }

  /* Campaigns: action buttons wrap */
  #workers-tab .item > div:last-child { flex-wrap: wrap; }

  /* Settings form */
  #settings-tab .section-body { padding: 10px; }

  /* Analytics charts */
  #analytics-tab canvas { max-height: 180px !important; }

  /* Visitors table horizontal scroll */
  #visitors-tab .section-body > div { overflow-x: auto; }

  /* Admin: Files tab filter row */
  #files-tab .section-head > div:last-child {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }

  /* Admin: Requests tab collapsible headers */
  #requests-tab .section-head { cursor: pointer; }
  #requests-tab .section-head svg { width: 16px; height: 16px; }

  /* Admin: Templates admin buttons */
  #templates-admin-tab .section-head > div:last-child {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Admin: Storage tab */
  #storage-admin-tab .section-body > div:nth-child(2) > div:last-child {
    flex-direction: column;
    gap: 8px;
  }
  #storage-admin-tab .section-body input { width: 100%; }

  /* Admin: 4-stat grid perfect fit */
  #admin-stats.stats-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .stats-grid { gap: 3px; }
  .stat-card { padding: 6px 1px; border-radius: 6px; }
  .stat-value { font-size: 13px; }
  .stat-icon { width: 22px; height: 22px; }
  .stat-icon svg { width: 11px; height: 11px; }

  .template-card { flex-direction: column; align-items: stretch; padding: 12px; gap: 8px; }
  .template-title-row .title { white-space: normal; overflow: visible; font-size: 13px; }
  .template-actions { width: 100%; }
  .template-actions .btn { flex: 1; min-height: 40px; }

  .item { padding: 10px; gap: 6px; }
  .item .title { font-size: 12px; }
  .item .meta { font-size: 10px; }

  .btn { min-height: 40px; padding: 8px 12px; font-size: 12px; }
  .btn.small { min-height: 32px; padding: 5px 8px; font-size: 10px; }

  input, textarea, select { min-height: 40px; padding: 8px; font-size: 12px; }

  .section-head h2 { font-size: 11px; }

  .analytics-card { padding: 10px; }

  table { font-size: 10px; }
  th, td { padding: 6px 6px; }

  .modal-body { padding: 10px 14px; }
  .modal-content { border-radius: 14px 14px 0 0; max-height: 92vh; }
}
