:root {
  --bg-dark: #0c1018;
  --bg-card: #151b26;
  --bg-card-hover: #1b2230;
  --bg-input: #0f1520;
  --border-color: #283344;
  --border-focus: #8b7cf8;
  --primary: #8b7cf8;
  --primary-hover: #7868eb;
  --accent: #8b7cf8;
  --text-main: #f1f5f9;
  --text-muted: #a8b5c6;
  --text-dim: #8090a5;
  --shadow: none;
  --shadow-glow: 0 0 0 3px rgba(139, 124, 248, .16);
}

body { background: var(--bg-dark); }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon,
.nav-item svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#mainApp .layout-container { display: flex; align-items: stretch; width: 100%; min-height: 100vh; }
#mainApp .sidebar { position: sticky; top: 0; width: 232px; height: 100vh; flex: none; justify-content: flex-start; overflow-y: auto; padding: 20px 13px 16px; background: #111722; border-right: 1px solid var(--border-color); }
#mainApp .sidebar { scrollbar-width: thin; scrollbar-color: #485570 #111722; }
#mainApp .sidebar::-webkit-scrollbar { width: 9px; }
#mainApp .sidebar::-webkit-scrollbar-track { background: #111722; }
#mainApp .sidebar::-webkit-scrollbar-thumb { background: #485570; border: 2px solid #111722; border-radius: 9px; }
#mainApp .sidebar::-webkit-scrollbar-thumb:hover { background: #69789b; }
#mainApp .sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
#mainApp .brand-avatar { width: 37px; height: 37px; flex: none; border-radius: 10px; background: var(--accent); color: #0b1020; font-size: 12px; font-weight: 800; letter-spacing: -.05em; box-shadow: none; }
#mainApp .brand-title { font-size: 17px; letter-spacing: -.03em; }
#mainApp .brand-badge { color: var(--text-muted); font-size: 10px; letter-spacing: .16em; }
#mainApp .sidebar > .guild-select-wrapper { display: grid; gap: 8px; margin-bottom: 19px; padding: 0 5px; }
#mainApp .sidebar > .guild-select-wrapper label { color: var(--text-dim); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
#mainApp .sidebar > .guild-select-wrapper select { min-width: 0; width: 100%; padding: 11px 32px 11px 10px; border-radius: 9px; background: var(--bg-card); border-color: var(--border-color); color: var(--text-main); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
#mainApp .sidebar-menu { gap: 3px; }
#mainApp .sidebar-group-label { padding: 16px 11px 7px; color: #78899e; font-size: 10px; letter-spacing: .11em; }
#mainApp .nav-item { min-height: 39px; gap: 10px; padding: 9px 11px; color: var(--text-muted); font-size: 12.5px; font-weight: 600; border-radius: 8px; white-space: nowrap; }
#mainApp .nav-item .icon { width: 17px; height: 17px; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; }
#mainApp .nav-item:hover { background: #1d2533; color: var(--text-main); }
#mainApp .nav-item.active { position: relative; background: #262b3d; color: var(--text-main); box-shadow: none; }
#mainApp .nav-item.active::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
#mainApp .sidebar-footer { display: grid; gap: 13px; margin-top: auto; padding: 16px 8px 0; border-color: var(--border-color); }
#mainApp .sidebar-footer a { color: var(--text-muted); font-size: 11px; line-height: 1.4; }
#mainApp .sidebar-footer a:hover { color: var(--text-main); }
#mainApp .tech-badge { display: none; }
#mainApp .status-indicator { display: inline-flex; width: fit-content; gap: 7px; padding: 0; border: 0; background: transparent; color: #80dfb1; font-size: 11px; font-weight: 600; }
#mainApp .status-dot { width: 7px; height: 7px; box-shadow: none; animation: none; }
#mainApp .workspace { flex: 1; min-width: 0; }

#mainApp .navbar { height: 62px; min-height: 62px; padding: 0 30px; background: #0d131d; backdrop-filter: none; border-bottom: 1px solid var(--border-color); }
#mainApp .mobile-menu-toggle,
#mainApp .mobile-drawer-close,
#mainApp .mobile-sidebar-backdrop { display: none; }
#mainApp .nav-left { min-width: 0; gap: 10px; color: var(--text-main); font-size: 12px; font-weight: 700; }
#mainApp .nav-breadcrumb { display: flex; align-items: center; gap: 10px; min-width: 0; }
#mainApp .nav-left span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#mainApp .nav-left #headerGuildName { color: var(--text-muted); font-weight: 500; }
#mainApp .nav-divider { color: #586a80; }
#mainApp .nav-right { gap: 16px; }
#mainApp .language-select-wrapper { gap: 7px; font-size: 11px; }
#mainApp .language-select-wrapper label { color: var(--text-dim); }
#mainApp .language-select-wrapper select { width: 125px; padding: 7px 10px; font-size: 11px; }
#mainApp .user-profile-badge { border-color: var(--border-color); background: transparent; }
#mainApp .user-avatar-img { width: 28px; height: 28px; }
#mainApp .user-name-label { font-size: 11px; }
#mainApp .user-role-tag { font-size: 9px; }
#mainApp .btn-icon-only { color: var(--text-muted); }
#mainApp #saveAllTopBtn { padding: 9px 13px; font-size: 11px; }
#mainApp .content-area { max-width: 1520px; padding: 31px 35px 70px; margin: 0 auto; }

#mainApp .overview-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
#mainApp .commands-intro { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 22px; }
#mainApp .commands-intro h1 { margin: 0 0 7px; font-size: clamp(24px, 2.4vw, 31px); letter-spacing: -.04em; }
#mainApp .commands-intro p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
#mainApp .commands-count { flex: none; color: var(--accent); font-size: 13px; font-weight: 800; }
#mainApp .commands-search-label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 12px; font-weight: 700; }
#mainApp .commands-search { width: 100%; max-width: 520px; margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--bg-card); color: var(--text-main); font: inherit; }
#mainApp .commands-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#mainApp .commands-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#mainApp .command-card { min-width: 0; padding: 16px 18px; border: 1px solid var(--border-color); border-radius: 11px; background: var(--bg-card); }
#mainApp .command-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#mainApp .command-name { color: var(--accent); font-size: 14px; overflow-wrap: anywhere; }
#mainApp .command-permission { padding: 3px 7px; border-radius: 5px; background: #272b40; color: #b7baf8; font-size: 10px; font-weight: 700; }
#mainApp .command-card p { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
#mainApp .command-arguments { display: block; margin-top: 10px; color: var(--text-dim); line-height: 1.5; overflow-wrap: anywhere; }
#mainApp .command-subcommands { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
#mainApp .command-subcommand { display: grid; gap: 3px; font-size: 11px; }
#mainApp .command-subcommand code { color: var(--text-main); font-size: 11px; overflow-wrap: anywhere; }
#mainApp .command-subcommand span { color: var(--text-muted); line-height: 1.4; }
#mainApp .section-kicker { display: inline-block; margin-bottom: 9px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
#mainApp .overview-intro h1 { margin: 0 0 6px; color: var(--text-main); font-size: clamp(24px, 2.4vw, 31px); font-weight: 800; letter-spacing: -.04em; line-height: 1.2; }
#mainApp .overview-intro p { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
#mainApp .overview-intro p strong { color: var(--text-main); font-weight: 700; }
#mainApp .overview-discord-link { padding: 9px 11px; background: #151b26; font-size: 11px; }
#mainApp .overview-discord-link .ui-icon { width: 14px; height: 14px; }
#mainApp .overview-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
#mainApp .summary-card { position: relative; min-height: 113px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 17px 18px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; }
#mainApp .summary-icon { position: absolute; right: 17px; top: 17px; width: 17px; height: 17px; color: var(--accent); }
#mainApp .summary-label { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; }
#mainApp .summary-card strong { color: var(--text-main); font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
#mainApp .summary-card > span:last-child { color: var(--text-muted); font-size: 11px; line-height: 1.4; }
#mainApp .overview-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 24px; margin-bottom: 31px; align-items: start; }
#mainApp .overview-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
#mainApp .overview-section-heading h2 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
#mainApp .overview-section-heading > span { color: var(--text-dim); font-size: 11px; text-align: right; }
#mainApp .overview-module { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; padding: 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-main); text-align: left; cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
#mainApp .overview-module:hover { background: #1d2635; border-color: #586587; transform: translateX(2px); }
#mainApp .overview-module:focus-visible, #mainApp .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#mainApp .module-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 8px; color: var(--accent); background: #202639; }
#mainApp .module-icon .ui-icon { width: 17px; height: 17px; }
#mainApp .module-copy { flex: 1; min-width: 0; }
#mainApp .module-copy strong, #mainApp .module-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#mainApp .module-copy strong { font-size: 12px; font-weight: 700; }
#mainApp .module-copy small { margin-top: 3px; color: var(--text-muted); font-size: 10px; }
#mainApp .module-state { flex: none; padding: 5px 7px; background: #163329; border-radius: 5px; color: #80dfb1; font-size: 10px; font-weight: 700; }
#mainApp .module-state.is-off { color: var(--text-muted); background: #252e3c; }
#mainApp .module-chevron { width: 15px; height: 15px; color: var(--text-dim); }
#mainApp .overview-tip { padding: 11px 4px; color: var(--text-muted); font-size: 11px; line-height: 1.5; }

#mainApp .sample-discord { min-height: 341px; padding: 16px; background: #25272f; border-radius: 10px; color: #f2f3f5; }
#mainApp .sample-author { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
#mainApp .sample-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; color: white; background: #6975df; font-size: 10px; font-weight: 800; }
#mainApp .sample-author strong, #mainApp .sample-author small { display: block; }
#mainApp .sample-author strong { font-size: 11px; }
#mainApp .sample-author small { margin-top: 2px; color: #aeb1ba; font-size: 10px; }
#mainApp .sample-author em { margin-left: 2px; padding: 2px 4px; border-radius: 3px; background: #5865f2; font-size: 8px; font-style: normal; }
#mainApp .sample-embed { margin-left: 43px; padding: 13px; border-left: 3px solid var(--sample-accent, var(--accent)); border-radius: 4px; background: #2e3038; }
#mainApp .sample-eyebrow { color: var(--sample-accent, var(--accent)); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
#mainApp .sample-embed > strong { display: block; margin: 8px 0 5px; font-size: 14px; }
#mainApp .sample-embed p { margin: 0 0 10px; color: #d2d5dc; font-size: 11px; line-height: 1.5; }
#mainApp .sample-art { display: flex; align-items: end; justify-content: space-between; height: 85px; padding: 11px; border-radius: 6px; background: radial-gradient(circle at 65% 60%, #3976ae 0, transparent 43%), linear-gradient(140deg, #172b52, #101722 68%); overflow: hidden; }
#mainApp .sample-art > span { font-size: 34px; font-weight: 800; letter-spacing: -.12em; }
#mainApp .sample-art > span span { color: var(--sample-accent, var(--accent)); }
#mainApp .sample-art small { font-size: 9px; letter-spacing: .16em; }
#mainApp .sample-footer { display: block; padding-top: 9px; color: #a4aab5; font-size: 10px; }
#mainApp .sample-button { display: inline-flex; align-items: center; gap: 5px; margin: 9px 0 0 43px; padding: 6px 10px; border-radius: 4px; background: #4b4f5b; color: #f2f3f5; font-size: 10px; font-weight: 700; }
#mainApp .sample-button .ui-icon { width: 12px; height: 12px; }
#mainApp .preview-caption { margin-top: 10px; color: var(--text-muted); font-size: 11px; line-height: 1.5; }

#mainApp .card, #mainApp .stat-card, #mainApp .sub-panel, #mainApp .step-card { border-color: var(--border-color); background: var(--bg-card); box-shadow: none; }
#mainApp .card { padding: 24px; border-radius: 12px; }
#mainApp .card-header { border-bottom-color: var(--border-color); }
#mainApp .card-header h2 { font-size: 17px; }
#mainApp .hero-card { border-color: var(--border-color); background: var(--bg-card); }
#mainApp .hero-card::after { display: none; }
#mainApp .gradient-text { background: none; color: var(--accent); -webkit-text-fill-color: currentColor; }
#mainApp .btn-primary, #mainApp .btn-accent { background: var(--accent); color: #0c1018; }
#mainApp .btn-primary:hover, #mainApp .btn-accent:hover { background: #a99eff; box-shadow: none; }
#mainApp .btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
#mainApp .btn-secondary { background: #1b2230; border-color: var(--border-color); }
#mainApp .btn-secondary:hover { background: #283247; border-color: #536179; }
#mainApp .styled-select, #mainApp .styled-input, #mainApp .styled-textarea { border-color: var(--border-color); background: var(--bg-input); }
#mainApp .styled-select:focus, #mainApp .styled-input:focus, #mainApp .styled-textarea:focus { border-color: var(--accent); box-shadow: var(--shadow-glow); }
#mainApp .save-footer { border-color: var(--border-color); background: var(--bg-card); }
#mainApp .subtab-btn.active, #mainApp .feed-style-choice.selected { background: #262b3d; border-color: var(--accent); color: var(--text-main); box-shadow: none; }

#mainApp .welcome-background-uploader { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .85fr); gap: 18px; align-items: center; margin: 12px 0 18px; padding: 17px; border: 1px solid var(--border-color); border-radius: 12px; background: #111722; }
#mainApp .welcome-background-controls label { display: block; margin-bottom: 5px; color: var(--text-main); font-size: 14px; font-weight: 700; }
#mainApp .welcome-background-controls p { margin-bottom: 13px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
#mainApp #welcomeBackgroundFile { padding: 8px; font-size: 12px; }
#mainApp #welcomeBackgroundFile::file-selector-button { margin-right: 10px; padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 6px; background: #252e3c; color: var(--text-main); cursor: pointer; }
#mainApp .welcome-background-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
#mainApp #welcomeBackgroundStatus { color: var(--text-muted); font-size: 11px; }
#mainApp .welcome-background-preview { position: relative; aspect-ratio: 12 / 5; min-height: 170px; overflow: hidden; border-radius: 9px; background: #1d2533; }
#mainApp .welcome-background-preview[hidden] { display: none; }
#mainApp .welcome-background-preview::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,11,21,.16), rgba(7,11,21,.8)); }
#mainApp .welcome-background-preview > img { display: block; width: 100%; height: 100%; object-fit: cover; }
#mainApp .welcome-background-preview-content { position: absolute; z-index: 1; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; color: white; text-shadow: 0 2px 10px #000; }
#mainApp .welcome-background-preview-content > span { display: grid; place-items: center; width: 51px; height: 51px; margin-bottom: 4px; border: 3px solid #8b7cf8; border-radius: 50%; background: #222b40; font-size: 12px; font-weight: 800; }
#mainApp .welcome-background-preview-content strong { font-size: 20px; }
#mainApp .welcome-background-preview-content small { font-size: 10px; }

.login-overlay { background: #0c1018; }
.login-box { background: #151b26; border-color: #283344; box-shadow: 0 20px 70px rgba(0,0,0,.28); }
.login-icon { background: #8b7cf8; box-shadow: none; }
.login-box .btn-discord { background: #8b7cf8; color: #0c1018; }

@media (max-width: 1120px) {
  #mainApp .sidebar { width: 210px; }
  #mainApp .content-area { padding: 28px 23px 65px; }
  #mainApp .overview-grid { gap: 16px; }
}

/* ========================================================
   MOBILE & TABLET NATIVE APP DESIGN (<= 900px)
   ======================================================== */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  #mainApp .layout-container {
    display: flex;
    flex-direction: column;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Off-Canvas Slide-out Sidebar Drawer */
  #mainApp .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 310px);
    height: 100dvh;
    z-index: 2500;
    background: #111722;
    border-right: 1px solid var(--border-color);
    border-bottom: 0;
    padding: 18px 14px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.72);
    display: flex;
    flex-direction: column;
  }

  #mainApp .sidebar.mobile-open {
    transform: translateX(0);
  }

  #mainApp .mobile-sidebar-backdrop.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2400;
  }

  #mainApp .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
  }

  #mainApp .mobile-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: #1b2230;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
  }

  #mainApp .sidebar > .guild-select-wrapper {
    position: static;
    width: 100%;
    margin: 0 0 14px;
    padding: 0;
    display: grid;
    gap: 6px;
  }

  #mainApp .sidebar > .guild-select-wrapper label {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
  }

  #mainApp .sidebar > .guild-select-wrapper select {
    font-size: 15px !important;
    padding: 11px 12px;
  }

  #mainApp .sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0;
    overflow: visible;
  }

  #mainApp .sidebar-group-label {
    display: block;
    padding: 14px 10px 6px;
  }

  #mainApp .nav-item {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    padding: 10px 12px;
    white-space: normal;
  }

  #mainApp .sidebar-footer {
    display: grid;
    margin-top: auto;
    padding-top: 16px;
  }

  /* Sticky Top Mobile Navbar */
  #mainApp .navbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: rgba(13, 19, 29, 0.96);
    backdrop-filter: blur(12px);
    padding: 10px 14px;
    min-height: 58px;
    height: auto;
    gap: 10px;
  }

  #mainApp .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: #1b2230;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
  }

  #mainApp .mobile-menu-icon {
    font-size: 16px;
    line-height: 1;
    color: var(--accent);
  }

  #mainApp .nav-breadcrumb {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
    flex: 1;
    cursor: pointer;
  }

  #mainApp .nav-breadcrumb .nav-divider {
    display: none;
  }

  #mainApp .nav-breadcrumb #currentTabLabel {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-main);
    max-width: 100%;
  }

  #mainApp .nav-breadcrumb #headerGuildName {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    max-width: 100%;
  }

  #mainApp .overview-grid { grid-template-columns: 1fr; }
  #mainApp .welcome-background-uploader { grid-template-columns: 1fr; }

  /* Fix Form Row & Grid Children on Mobile */
  #mainApp .form-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  #mainApp .form-row > .form-group,
  #mainApp .form-row > div {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  #mainApp .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

@media (max-width: 680px) {
  #mainApp .navbar {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  #mainApp .nav-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  #mainApp .nav-right {
    width: auto;
    flex-shrink: 0;
    gap: 6px;
  }

  #mainApp .language-select-wrapper label,
  #mainApp .user-info-text {
    display: none;
  }

  #mainApp .language-select-wrapper select {
    width: 54px;
    padding: 7px 6px;
    font-size: 13px !important;
  }

  #mainApp .user-profile-badge {
    padding: 4px 6px;
    gap: 4px;
  }

  #mainApp #saveAllTopBtn {
    padding: 8px 11px;
    font-size: 12px;
    min-height: 36px !important;
  }

  #mainApp .content-area {
    padding: 16px 12px 80px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  #mainApp .overview-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  #mainApp .commands-intro { align-items: flex-start; flex-direction: column; }
  #mainApp .commands-list { grid-template-columns: 1fr; }

  #mainApp .overview-intro h1 {
    font-size: 22px;
  }

  #mainApp .overview-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #mainApp .summary-card {
    min-height: 88px;
    padding: 14px 16px;
  }

  #mainApp .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  #mainApp .stat-card {
    padding: 14px;
    gap: 10px;
  }

  #mainApp .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  #mainApp .stat-value {
    font-size: 18px;
  }

  #mainApp .card {
    padding: 16px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  #mainApp .sub-panel {
    padding: 14px 12px;
  }

  #mainApp .hero-card {
    padding: 20px 16px;
    margin-bottom: 18px;
  }

  #mainApp .hero-card h1 {
    font-size: 21px;
  }

  #mainApp .header-with-toggle {
    flex-wrap: wrap;
    gap: 12px;
  }

  #mainApp .toggle-card {
    padding: 14px;
    gap: 12px;
  }

  /* Prevent iOS Auto-Zoom on Inputs and Fix Fixed Max-Widths */
  #mainApp .styled-input,
  #mainApp .styled-select,
  #mainApp .styled-textarea,
  #mainApp .roles-search-input {
    font-size: 16px !important;
    max-width: 100% !important;
  }

  /* Allow Buttons with Long Bulgarian Labels to Wrap Cleanly */
  #mainApp .btn {
    white-space: normal;
    text-align: center;
    line-height: 1.35;
    height: auto !important;
    min-height: 42px;
    max-width: 100%;
    flex-shrink: 1;
    padding: 10px 14px;
  }

  #mainApp .action-bar,
  #mainApp .action-buttons-row,
  #mainApp .hero-actions,
  #mainApp .feed-editor-buttons,
  #mainApp .tags-add-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #mainApp .action-bar .btn,
  #mainApp .action-buttons-row .btn,
  #mainApp .hero-actions .btn,
  #mainApp .feed-editor-buttons .btn,
  #mainApp .tags-add-row .btn {
    width: 100%;
    justify-content: center;
  }

  /* Sub-tabs Segmented Stack on Mobile */
  #mainApp .subtabs-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    padding: 8px !important;
  }

  #mainApp .subtab-btn {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    text-align: left !important;
    padding: 11px 14px !important;
    font-size: 13.5px !important;
    white-space: normal !important;
  }

  /* Window Styles, Themes & Checkboxes on Mobile */
  #mainApp .window-styles-grid,
  #mainApp .checkbox-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #mainApp .theme-palette-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  /* Discord Live Embed Preview Mobile Optimization */
  #mainApp .preview-box {
    padding: 12px;
    overflow-x: hidden;
  }

  #mainApp .discord-message-mock {
    gap: 10px;
  }

  #mainApp .discord-avatar-col {
    display: none;
  }

  #mainApp .discord-embed-card {
    max-width: 100%;
    padding: 12px;
  }

  #mainApp .sample-embed,
  #mainApp .sample-button {
    margin-left: 0;
  }

  /* Invite Banner Mobile Layout */
  #mainApp .invite-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 16px;
    gap: 14px;
  }

  #mainApp .invite-banner-content {
    flex-direction: column;
    gap: 8px;
  }

  /* Compact Sticky Bottom Save Bar */
  #mainApp .save-footer {
    position: sticky;
    bottom: 8px;
    padding: 10px 12px;
    flex-direction: row;
    gap: 10px;
    z-index: 95;
    border-radius: 12px;
    margin-top: 20px;
  }

  #mainApp .save-footer span {
    display: none;
  }

  #mainApp .save-footer .btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
  }

  /* Mobile Toast Notifications */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 72px;
  }

  .toast {
    width: 100%;
    font-size: 13px;
    padding: 12px 14px;
  }

  .login-box {
    padding: 28px 20px;
  }
}

@media (max-width: 420px) {
  #mainApp .mobile-menu-label {
    display: none;
  }
  #mainApp .mobile-menu-toggle {
    padding: 8px 10px;
  }
  #mainApp .stats-grid {
    grid-template-columns: 1fr;
  }
  #mainApp .overview-module {
    gap: 8px;
    padding: 10px 8px;
  }
  #mainApp .module-icon {
    width: 30px;
    height: 30px;
  }
}
