/* CSS Variables for Theme Support */
    :root {
      --bg-primary: var(--surface-page);
      --bg-secondary: var(--surface-card-alt);
      --bg-tertiary: var(--surface-soft);
      --bg-card: var(--surface-card);
      --text-primary: var(--text-primary);
      --text-secondary: var(--text-secondary);
      --text-muted: var(--text-muted);
      --accent-primary: var(--primary);
      --accent-secondary: var(--primary-dark);
      --border-color: var(--border-light);
      --border-light: var(--surface-soft);
      --success: var(--green);
      --warning: var(--orange);
      --error: var(--red);
      --radius: 18px;
      --shadow: var(--shadow-sm);
      --shadow-lg: var(--shadow-md);
      --sidebar-width: 260px;
    }

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

    html, body {
      height: 100%;
      font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background-color: var(--bg-primary);
      color: var(--text-primary);
      transition: background-color 0.3s ease, color 0.3s ease;
    }

    a {
      color: inherit;
      text-decoration: none;
    }

    button, select, input, textarea {
      font: inherit;
      border: none;
      outline: none;
    }

    /* Auth Styles */
    .auth-wrap {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 24px;
      background: linear-gradient(135deg, var(--deep-magenta) 0%, var(--red-pink) 100%);
    }

    .card {
      width: 100%;
      max-width: 420px;
      background: var(--bg-card);
      border-radius: var(--radius);
      box-shadow: var(--shadow-lg);
      padding: 32px;
      border: 1px solid var(--border-color);
    }

    .card h1 {
      margin: 0 0 8px;
      font-size: 24px;
      font-weight: 700;
      text-align: center;
    }

    .card p {
      margin: 0 0 24px;
      color: var(--text-secondary);
      font-size: 14px;
      text-align: center;
    }

    .field {
      margin-bottom: 16px;
    }

    .label {
      display: block;
      font-size: 14px;
      font-weight: 500;
      color: var(--text-secondary);
      margin-bottom: 8px;
    }

    .input, .select, .textarea {
      width: 100%;
      padding: 12px 16px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      color: var(--text-primary);
      transition: all 0.2s ease;
    }

    .input:focus, .select:focus, .textarea:focus {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    .textarea {
      min-height: 96px;
      resize: vertical;
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: var(--accent-primary);
      border: none;
      color: white;
      padding: 12px 20px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 500;
      transition: all 0.2s ease;
      box-shadow: var(--shadow);
      width: 100%;
    }

    .btn:hover {
      background: var(--accent-secondary);
      transform: translateY(-1px);
      box-shadow: var(--shadow-lg);
    }

    .btn.secondary {
      background: var(--bg-tertiary);
      color: var(--text-primary);
      border: 1px solid var(--border-color);
    }

    .btn.danger {
      background: var(--error);
    }

    .hint {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 16px;
      line-height: 1.5;
      text-align: center;
    }

    .auth-actions {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-top: 16px;
    }

    .auth-divider {
      display: flex;
      align-items: center;
      margin: 16px 0;
      color: var(--text-muted);
      font-size: 14px;
    }

    .auth-divider::before,
    .auth-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border-color);
    }

    .auth-divider span {
      padding: 0 12px;
    }

    .link {
      background: none;
      border: 0;
      color: var(--accent-primary);
      padding: 0;
      cursor: pointer;
      font-size: 14px;
      text-decoration: underline;
      width: auto;
      display: inline;
    }

    .notice {
      color: var(--success);
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.2);
      padding: 12px 16px;
      border-radius: 8px;
      margin: 16px 0;
      display: none;
    }

    .error {
      color: var(--error);
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.2);
      padding: 12px 16px;
      border-radius: 8px;
      margin: 16px 0;
      display: none;
    }

    /* App Layout */
    .app {
      display: none;
      min-height: 100vh;
    }

    .layout {
      display: grid;
      grid-template-columns: var(--sidebar-width) 1fr;
      gap: 0;
      min-height: 100vh;
    }

    /* Sidebar */
    .side {
      background: var(--bg-secondary);
      border-right: 1px solid var(--border-color);
      padding: 20px;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow-y: auto;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border-color);
    }

    .brand img {
      width: 36px;
      height: 36px;
      border-radius: 8px;
    }

    .brand h2 {
      font-size: 18px;
      font-weight: 700;
      margin: 0;
    }

    .shopbox {
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      border-radius: var(--radius);
      padding: 16px;
      margin: 16px 0;
      font-size: 14px;
      color: var(--text-secondary);
    }

    .shopbox-header {
      font-weight: 600;
      margin-bottom: 4px;
    }

    .nav a {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      margin: 4px 0;
      border-radius: 8px;
      color: var(--text-secondary);
      transition: all 0.2s ease;
    }

    .nav a:hover {
      background: var(--bg-tertiary);
      color: var(--text-primary);
    }

    .nav a.active {
      background: var(--accent-primary);
      color: white;
    }

    .nav .sep {
      height: 1px;
      background: var(--border-color);
      margin: 16px 0;
    }

    /* Main Content */
    .main {
      padding: 24px;
      background: var(--bg-primary);
      overflow-y: auto;
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 12px;
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border-color);
    }

    .topbar .actions {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-left: auto;
    }

    .pill {
      font-size: 14px;
      color: var(--text-secondary);
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      padding: 6px 12px;
      border-radius: 20px;
    }

    .logout {
      background: var(--bg-tertiary);
      border: 1px solid var(--border-color);
      color: var(--text-primary);
      padding: 8px 16px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .logout:hover {
      background: var(--bg-secondary);
    }

    /* Sections */
    .section {
      display: none;
    }

    .section.active {
      display: block;
    }

    /* Toolbar */
    .toolbar {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 20px;
      padding: 16px;
      background: var(--bg-card);
      border-radius: var(--radius);
      border: 1px solid var(--border-color);
    }

    .toolbar input, .toolbar select {
      background: var(--bg-tertiary);
      color: var(--text-primary);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 10px 12px;
    }

    .toolbar .btn {
      padding: 10px 16px;
      width: auto;
    }

    /* List */
    .list {
      list-style: none;
      margin: 0;
      padding: 0;
      border: 1px solid var(--border-color);
      border-radius: var(--radius);
      overflow: hidden;
      background: var(--bg-card);
    }

    .row {
      display: grid;
      grid-template-columns: 56px 1fr 140px 110px 140px;
      gap: 16px;
      align-items: center;
      padding: 16px;
      border-bottom: 1px solid var(--border-color);
      background: var(--bg-card);
      transition: background 0.2s ease;
    }

    .row:nth-child(odd) {
      background: var(--bg-tertiary);
    }

    .row:hover {
      background: var(--bg-secondary);
    }

    .thumb {
      width: 44px;
      height: 44px;
      border-radius: 8px;
      background: var(--bg-tertiary);
      display: grid;
      place-items: center;
      font-size: 12px;
      color: var(--text-muted);
      overflow: hidden;
    }

    .thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .status {
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 500;
      display: inline-block;
    }

    .status.ok {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .status.draft {
      background: rgba(245, 158, 11, 0.15);
      color: var(--warning);
      border: 1px solid rgba(245, 158, 11, 0.3);
    }

    .status.disabled {
      background: rgba(239, 68, 68, 0.15);
      color: var(--error);
      border: 1px solid rgba(239, 68, 68, 0.3);
    }

    .muted {
      color: var(--text-muted);
      font-size: 14px;
    }

    .pager {
      display: flex;
      align-items: center;
      gap: 12px;
      justify-content: flex-end;
      margin-top: 20px;
    }

    /* Dashboard Styles */
    .db-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24px;
      gap: 16px;
    }

    .db-title {
      font-size: 24px;
      font-weight: 700;
    }

    .db-right {
      display: flex;
      gap: 12px;
      align-items: center;
    }

    .db-btn {
      border: 1px solid var(--border-color);
      background: var(--bg-card);
      color: var(--text-primary);
      padding: 10px 16px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
      width: auto;
    }

    .db-btn:hover {
      background: var(--bg-tertiary);
    }

    .db-btn.brand {
      background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
      border: 0;
      color: white;
      font-weight: 600;
    }

    .db-pill {
      display: inline-block;
      border: 1px solid var(--border-color);
      border-radius: 20px;
      padding: 6px 12px;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      font-size: 14px;
    }

    .db-grid-4 {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 16px;
      margin-bottom: 24px;
    }

    .db-grid-2 {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 16px;
    }

    @media (max-width: 1200px) {
      .db-grid-4 {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    @media (max-width: 768px) {
      .db-grid-4, .db-grid-2 {
        grid-template-columns: 1fr;
      }
    }

    .db-card {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius);
      padding: 20px;
      box-shadow: var(--shadow);
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .db-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }

    .db-metric .k {
      font-size: 28px;
      font-weight: 700;
      margin-top: 8px;
    }

    .db-metric .s {
      font-size: 14px;
      color: var(--text-secondary);
    }

    .db-hr {
      border: none;
      border-top: 1px solid var(--border-color);
      margin: 16px 0;
    }

    .db-list {
      list-style: none;
      margin: 0;
      padding: 0;
      max-height: 300px;
      overflow: auto;
    }

    .db-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 0;
      border-bottom: 1px dashed var(--border-color);
    }

    .db-row:last-child {
      border-bottom: none;
    }

    .db-banner {
      display: none;
      margin: 16px 0;
      padding: 16px;
      border-radius: var(--radius);
      border: 1px solid var(--border-color);
      background: var(--bg-card);
    }

    .db-banner.err {
      border-left: 4px solid var(--error);
      color: var(--error);
    }

    .db-toast {
      position: fixed;
      right: 20px;
      bottom: 20px;
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-left: 4px solid var(--success);
      border-radius: var(--radius);
      padding: 16px;
      box-shadow: var(--shadow-lg);
      display: none;
      z-index: 100;
      max-width: 320px;
    }

    .db-toast.show {
      display: block;
      animation: slideIn 0.3s ease;
    }

    .db-modal {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      padding: 20px;
    }

    .db-modal.on {
      display: flex;
    }

    .db-sheet {
      width: min(640px, 100%);
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius);
      padding: 24px;
      box-shadow: var(--shadow-lg);
    }

    .db-sheet h3 {
      margin: 0 0 16px;
      font-size: 20px;
      font-weight: 600;
    }

    .db-field {
      display: grid;
      grid-template-columns: 120px 1fr;
      gap: 12px;
      align-items: center;
      margin: 12px 0;
    }

    .db-input {
      width: 100%;
      background: var(--bg-tertiary);
      color: var(--text-primary);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      padding: 12px;
    }

    .db-shops {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 12px 0;
    }

    .db-shopbtn {
      border: 1px solid var(--border-color);
      background: var(--bg-tertiary);
      color: var(--text-primary);
      padding: 10px 16px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .db-shopbtn:hover {
      background: var(--bg-secondary);
    }

    /* Comments / Questions section */
    .comments-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 12px;
    }

    .comments-header h2 {
      font-size: 22px;
      font-weight: 600;
    }

    .comments-stats {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .comments-list .c-row {
      display: grid;
      grid-template-columns: 56px 2fr 1.1fr 110px 160px;
      gap: 16px;
      align-items: flex-start;
      padding: 16px;
      border-bottom: 1px solid var(--border-color);
      background: var(--bg-card);
      font-size: 14px;
    }

    .comments-list .c-row:nth-child(odd) {
      background: var(--bg-tertiary);
    }

    .comments-list .c-row:hover {
      background: var(--bg-secondary);
    }

    .c-meta {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .c-text {
      font-size: 14px;
      margin-top: 4px;
      color: var(--text-primary);
    }

    .c-stars {
      font-size: 13px;
      color: #f59e0b;
      margin-top: 4px;
    }

    .c-type {
      font-size: 13px;
      font-weight: 500;
      padding: 4px 10px;
      border-radius: 999px;
      border: 1px solid var(--border-color);
      background: var(--bg-tertiary);
      display: inline-block;
    }

    .c-actions {
      display: flex;
      flex-direction: column;
      gap: 6px;
      align-items: stretch;
    }

    .c-actions .logout {
      font-size: 12px;
      padding: 6px 8px;
    }

    .c-status-pill {
      font-size: 12px;
      padding: 4px 10px;
      border-radius: 999px;
      border: 1px solid var(--border-color);
      display: inline-block;
    }

    .c-status-pending {
      background: rgba(245, 158, 11, 0.15);
      color: var(--warning);
      border-color: rgba(245, 158, 11, 0.4);
    }

    .c-status-approved {
      background: rgba(16, 185, 129, 0.15);
      color: var(--success);
      border-color: rgba(16, 185, 129, 0.4);
    }

    .c-status-rejected {
      background: rgba(239, 68, 68, 0.15);
      color: var(--error);
      border-color: rgba(239, 68, 68, 0.4);
    }

    .comments-empty {
      margin-top: 12px;
      font-size: 14px;
      color: var(--text-muted);
    }

    .reply-meta {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .reply-meta strong {
      color: var(--text-primary);
    }

    /* Animations */
    @keyframes slideIn {
      from {
        transform: translateX(100%);
        opacity: 0;
      }
      to {
        transform: translateX(0);
        opacity: 1;
      }
    }

    /* Responsive */
    @media (max-width: 980px) {
      .layout {
        grid-template-columns: 1fr;
      }

      .side {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
      }

      .row {
        grid-template-columns: 1fr;
        gap: 12px;
      }

      .toolbar {
        flex-direction: column;
        align-items: stretch;
      }

      .toolbar > * {
        width: 100%;
      }

      .comments-list .c-row {
        grid-template-columns: 1fr;
      }

      .comments-header {
        flex-direction: column;
        align-items: flex-start;
      }
    }

    /* Live badge animation */
    .spin {
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--success);
      animation: pulse 1.5s infinite;
    }

    @keyframes pulse {
      0% {
        transform: scale(0.8);
        opacity: 0.7;
      }
      50% {
        transform: scale(1.2);
        opacity: 1;
      }
      100% {
        transform: scale(0.8);
        opacity: 0.7;
      }
    }
