/* ========================================
   Admin Template - Custom Styles
   ======================================== */
:root {
  --auth-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --color-primary: #4361ee;
  --topbar-height: 78px;
  --sidebar-color-text: #FFF;
  --auth-bg: var(--color-background);
  --bg_image: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
  --primary-gradient: linear-gradient(135deg, var(--color-primary) 0%, var(--color-purple) 100%);
  --sidebar-color-background: var(--primary-gradient);
  --header-color-background: var(--color-surface);
  --header-color-text: var(--color-text);
  --menu-highlight-bg: #000;
}
* {
  font-family: 'Kanit', sans-serif;
}
body {
  background-color: var(--color-background);
  margin: 0;
  padding: 0;
}
a {
  color: var(--color-primary);
}
a:hover {
  color: var(--color-primary-hover);
}
/* ========================================
   Layout
   ======================================== */
.main-content {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}
.main-content > div {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.content {
  gap: var(--space-8);
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 2rem;
  margin-top: var(--topbar-height);
  background-color: var(--color-background);
}
/* ========================================
   Sidebar
   ======================================== */
.sidebar {
  background: var(--sidebar-color-background);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
  color: var(--sidebar-color-text);
}
.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.sidebar-header .logo {
  width: 45px;
  height: 45px;
  background-size: cover;
  display: flex;
}
.sidebar-header .logo-text,
.topbar-left h1,
.topbar-left p,
.topbar-right .user-name {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sidebar-header .logo-text {
  font-size: 1.25rem;
  font-weight: 600;
}
.sidebar [data-component="api"] {
  height: 100%
}
.sidebar .sidemenu {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-height));
  scrollbar-width: none;
}
/* ========================================
   Topbar
   ======================================== */
.topbar {
  position: fixed;
  top: 0;
  left: var(--menu-width);
  right: 0;
  height: var(--topbar-height);
  z-index: 999;
  background: var(--header-color-background);
  color: var(--header-color-text);
  border-bottom: 1px solid var(--color-border);
  transition: left 0.3s ease;
}
.topbar > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: inherit;
}
.topbar .avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
}
.topbar-left {
  flex: 1;
}
.topbar-left h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}
.topbar-left p {
  margin: 0.25rem 0 0 0;
  font-size: 0.875rem;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-right button:hover,
.topbar-right button:focus,
.topbar-right button {
  box-shadow: none;
  background-color: transparent;
  color: inherit;
  border: none;
  padding: 0;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}
.user-info {
  text-align: left;
}
.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
}
.user-role {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
/* ========================================
   Dashboard Cards
   ======================================== */
.card-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.card-groups header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  margin-bottom: 0.75rem;
}
.card-groups h3,
.card-groups h2,
.card-groups h1 {
  display: flex;
  gap: 5px;
  margin: 0;
  align-items: baseline;
}
.card-groups h1 {
  font-size: 2rem;
  font-weight: 600;
}
.card-groups h2 {
  font-size: 1.5rem;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.stat-label {
  font-size: 14px;
  color: #6c757d;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 0 !important;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}
.stat-header {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-header::before {
  font-size: 40px;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.7;
  position: absolute;
  right: 0;
  top: 0;
}
.stat-card.positive .stat-change {
  color: var(--color-success);
}
.stat-card.negative .stat-change {
  color: var(--color-error);
}
/* ========================================
   AI Chat Console
   ======================================== */
.ai-chat-console {
  gap: var(--space-4);
}
.ai-chat-console__status {
  padding: .875rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-primary) 12%);
  color: var(--color-text-muted);
}
.ai-chat-console__messages {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-height: 280px;
  max-height: 460px;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(67, 97, 238, 0.08), transparent 32%),
    var(--color-surface);
}
.ai-chat-console__message {
  display: flex;
}
.ai-chat-console__message--user {
  justify-content: flex-end;
}
.ai-chat-console__bubble {
  max-width: min(85%, 720px);
  padding: .95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
.ai-chat-console__bubble p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.65;
}
.ai-chat-console__text {
  overflow-wrap: anywhere;
}
.ai-chat-console__inline-link {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 18rem);
  margin: .15rem 0;
  padding: .12rem .55rem;
  border-radius: 999px;
  background: rgba(67, 97, 238, 0.12);
  color: var(--color-primary);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.ai-chat-console__inline-link:hover {
  background: rgba(67, 97, 238, 0.18);
}
.ai-chat-console__message--user .ai-chat-console__inline-link {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.ai-chat-console__message--error .ai-chat-console__inline-link {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}
.ai-chat-console__message--user .ai-chat-console__bubble {
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 68%, #0f172a 32%));
  color: #fff;
}
.ai-chat-console__message--error .ai-chat-console__bubble {
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(254, 242, 242, 0.95);
  color: #991b1b;
}
.ai-chat-console__message--notice .ai-chat-console__bubble {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
  color: #1e40af;
}
.ai-chat-console__bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .75rem;
}
.ai-chat-console__bubble-action {
  border: 1px solid rgba(67, 97, 238, 0.28);
  background: #fff;
  color: var(--color-primary);
  border-radius: 999px;
  padding: .32rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.ai-chat-console__bubble-action:hover {
  background: rgba(67, 97, 238, 0.08);
}
.ai-chat-console__message--user .ai-chat-console__bubble-action {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.ai-chat-console__message--user .ai-chat-console__bubble-action:hover {
  background: rgba(255, 255, 255, 0.25);
}
.ai-chat-console__cards {
  display: grid;
  gap: .7rem;
  margin-top: .9rem;
}
.ai-chat-console__cards--only {
  margin-top: 0;
}
.ai-chat-console__card {
  padding: .75rem .85rem;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--color-text);
}
.ai-chat-console__card h4,
.ai-chat-console__card p {
  margin: 0;
}
.ai-chat-console__card p + p,
.ai-chat-console__card h4 + p {
  margin-top: .35rem;
}
.ai-chat-console__card-meta {
  color: var(--color-text-muted);
  font-size: .875rem;
}
.ai-chat-console__card-link {
  display: inline-flex;
  margin-top: .6rem;
  font-weight: 600;
}
.ai-chat-console__composer {
  display: grid;
  gap: .9rem;
}
.ai-chat-console__composer textarea {
  width: 100%;
  min-height: 96px;
  padding: .9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: #fff;
  resize: vertical;
}
.ai-chat-console__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
@media (max-width: 768px) {
  .ai-chat-console__bubble {
    max-width: 100%;
  }
}
/* ========================================
   Kanban Board
   ======================================== */
#kanban-board {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
}
.kanban-column {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  padding: 1rem;
  min-height: 500px;
  width: 300px;
}
.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
}
.column-title {
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text);
}
.column-count {
  background: var(--color-background);
  color: var(--color-text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.column-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100px;
}
.deal-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  cursor: move;
  transition: all 0.2s;
}
.deal-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}
.deal-card.sortable-ghost {
  opacity: 0.4;
  background: var(--color-background);
}
.deal-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}
.deal-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}
.deal-customer {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.deal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}
.deal-probability {
  background: var(--color-background);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.kanban-card {
  position: relative;
}
.card-edit {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--color-text-muted);
  background: var(--color-background);
  text-decoration: none;
  opacity: 0;
  transition: all 0.2s ease;
}
.kanban-card:hover .card-edit {
  opacity: 1;
}
.card-edit:hover {
  color: var(--color-primary);
  background: rgba(67, 97, 238, 0.1);
}
/* ========================================
   Charts
   ======================================== */
.content-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.content-body,
.ggrid section {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
}
.ggrid section h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}
/* ========================================
   Footer
   ======================================== */
.footer {
  background: var(--footer-color-background, inherit);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 2rem;
  text-align: center;
}
.footer p {
  margin: 0;
  color: var(--footer-color-text, inherit);
  font-size: 0.875rem;
}
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: var(--bg_image);
  background-size: cover;
}
.auth-card {
  width: 100%;
  max-width: 480px;
  box-shadow: var(--auth-shadow);
  position: relative;
  background: var(--auth-bg);
  border-radius: 1.5rem;
  padding: 2.5rem;
  overflow: hidden;
  animation: 0.6s ease-out 0s 1 normal none running authCardSlideUp;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0px;
  left: 0px;
  right: 0px;
  height: 4px;
  background: var(--primary-gradient);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.auth-form fieldset {
  margin-bottom: 0 !important;
}
.auth-form a:not(.auth-logo) {
  color: var(--color-primary);
}
.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.auth-logo {
  height: 64px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: contain;
}
.auth-logo::before {
  font-size: 3em;
}
.login-card h1 {
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
/* ========================================
   Social Login Styles
   ======================================== */
.social-divider {
  position: relative;
  text-align: center;
}
.social-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-border);
  z-index: 0;
}
.social-divider span {
  position: relative;
  display: inline-block;
  background: var(--color-background);
  padding: 0 1rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1;
}
.social-login-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  justify-content: center;
}
.social-login-buttons button {
  width: 100%;
}
.userinfo > span > .icon-facebook:before,
.social-login-buttons .icon-facebook {
  border-color: #1877f2;
  color: #1877f2;
}
.social-login-buttons .icon-facebook:hover {
  background: #1877f2;
  color: white;
  border-color: #1877f2;
}
.userinfo > span > .icon-line:before,
.social-login-buttons .icon-line {
  border-color: #00b900;
  color: #00b900;
}
.social-login-buttons .icon-line:hover {
  background: #00b900;
  color: white;
  border-color: #00b900;
}
.userinfo > span > .icon-google:before {
  color: #db4437;
}
.userinfo > span > .icon-telegram:before {
  color: #2ca5e0;
}
/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .topbar {
    left: 0;
  }
  .topbar > div {
    padding: 0 1rem;
  }
  .content {
    padding: 2rem 1rem
  }
  .kanban-board {
    grid-template-columns: 1fr;
  }
  .content-body,
  .ggrid section {
    padding: 1rem;
  }
  .auth-form,
  .auth-container {
    background: var(--color-background);
    height: 100%;
    max-width: auto;
    box-shadow: none;
    border-radius: 0;
  }
}
/* Trophy Icon Styles */
.icon-win.gold {
  font-size: 1.75rem;
  color: #ffd700;
  filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)) brightness(1);
}
.icon-win.silver {
  font-size: 1.75rem;
  color: #c0c0c0;
  filter: drop-shadow(0 4px 12px rgba(192, 192, 192, 1)) drop-shadow(0 0 20px rgba(192, 192, 192, 0.8)) brightness(1.2);
}
.icon-win.bronze {
  font-size: 1.75rem;
  color: #cd7f32;
  filter: drop-shadow(0 4px 12px rgba(205, 127, 50, 1)) drop-shadow(0 0 20px rgba(205, 127, 50, 0.8)) brightness(1.15);
}
.dashboard td {
  white-space: nowrap;
}
form fieldset legend {
  font-weight: 600;
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-2xl);
  display: flex;
  gap: 5px;
}
form fieldset legend .btn {
  margin-left: auto;
  font-size: 1rem;
  font-weight: normal;
}
/* ========================================
   Customer Detail View - Read-only Display
   ======================================== */
.customer-detail {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
}
/* Customer Header */
.customer-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background: var(--primary-gradient);
  color: white;
}
.customer-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  border: 3px solid rgba(255, 255, 255, 0.3);
}
.customer-title h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}
.customer-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.customer-meta .badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.customer-meta .meta-item {
  font-size: 0.875rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.customer-meta .meta-item::before {
  font-size: 0.875rem;
}
.customer-actions {
  margin-left: auto;
}
.rating-stars {
  font-size: 1.25rem;
  letter-spacing: 2px;
}
/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.detail-item.full-width {
  grid-column: span 2;
}
.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detail-label::before {
  font-size: 0.875rem;
  opacity: 0.7;
}
.detail-value {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 500;
}
.detail-value.highlight {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.125rem;
}
.detail-value.link {
  color: var(--color-primary);
  text-decoration: none;
  cursor: pointer;
}
.detail-value.link:hover {
  text-decoration: underline;
  background: rgba(59, 130, 246, 0.05);
}
.detail-value.notes {
  white-space: pre-wrap;
  line-height: 1.6;
}
.detail-value .badge {
  display: inline-block;
}
/* Responsive Detail Grid */
@media (max-width: 768px) {
  .customer-header {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }
  .customer-actions {
    margin-left: 0;
  }
  .customer-meta {
    justify-content: center;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-item.full-width {
    grid-column: span 1;
  }
}
/* Detail Sections - Single Page Layout */
.detail-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.detail-section {
  border-radius: 16px;
  border: 1px solid var(--color-border);
  padding: 1rem;
}
.detail-section:first-child {
  border-style: none solid solid solid;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.home-panel__header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.home-panel__header::before {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  color: white;
  border-radius: 8px;
  font-size: 1rem;
}
.userinfo > span span,
.userinfo a,
td .userinfo {
  display: flex;
  align-items: center;
  gap: 5px;
}
.userinfo > span {
  display: flex;
  flex-direction: column;
}
.userinfo a {
  font-size: 0.875rem;
}
td .thumbnail,
.usericon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9999px;
  font-weight: bold;
  background-color: var(--color-primary);
  color: white;
  background-size: cover;
  background-position: center;
  text-transform: uppercase;
}
.usericon[style*="url("]:not([style*="url(null)"]) {
  color: transparent;
}
.btn-table-action[data-action="active"][data-value="0"]:before,
.btn-table-action[data-action="active"][data-value="1"]:before {
  content: "✓";
  color: var(--color-silver);
  font-size: 1.5rem;
}
.btn-table-action[data-action="active"][data-value="1"]:before {
  color: var(--color-success);
}
td a {
  color: var(--color-primary);
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  cursor: pointer;
}
td .icon-move_left:before,
td .icon-move_right:before {
  font-size: 1.5rem;
}
@media (min-width: 769px) {
  .main-content {
    margin-left: var(--menu-width);
  }
  .sidemenu-close header {
    left: var(--sidebar-collapsed-width);
  }
  .sidemenu-close .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }
  .sidemenu-close .sidebar-header {
    padding-left: 10px;
    padding-right: 10px;
  }
  .sidemenu-close .menu-toggle {
    color: var(--color-text);
  }
  .sidemenu-close .logo-text {
    display: none;
  }
}
[data-component="graph"] {
  height: 300px;
}
/* ========================================
   Icon Picker
   ======================================== */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
  overflow-y: scroll;
  max-height: 13em;
}
.icon-picker label.icon-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 60px;
  min-height: 56px;
  padding: 6px 4px;
  border: 2px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
  cursor: pointer;
  background: var(--color-surface, #fff);
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.7rem;
  color: var(--color-text-muted, #888);
  text-align: center;
  word-break: break-all;
}
.icon-picker label.icon-option:hover {
  border-color: var(--color-primary, #4361ee);
  color: var(--color-primary, #4361ee);
}
.icon-picker label.icon-option:before {
  font-size: 1.4rem;
  line-height: 1;
  color: inherit;
}
.icon-picker label.icon-option.icon-none:before {
  content: '✕';
  font-family: sans-serif;
  font-size: 1rem;
  color: var(--color-text-muted, #aaa);
}
.icon-picker label.icon-option small {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.icon-picker input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.icon-picker input[type="radio"]:checked + label {
  border-color: var(--color-primary, #4361ee);
  background: color-mix(in srgb, var(--color-primary, #4361ee) 12%, transparent);
  color: var(--color-primary, #4361ee);
}
td.checkbox {
  text-align: center;
}
td.checkbox .form-control {
  border: none;
  display: inline-flex;
}
/* ========================================
   Theme Gallery
   ======================================== */
.theme-gallery {
  width: 100%;
}
.theme-loading {
  padding: 3rem;
  text-align: center;
  color: var(--color-text-secondary, #64748b);
  font-size: 1rem;
  gap: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: .25rem 0 1rem;
}
.theme-card {
  background: var(--color-surface, #f8fafc);
  border: 2px solid var(--color-border, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.theme-card:hover {
  border-color: var(--color-primary, #4361ee);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
  transform: translateY(-2px);
}
.theme-card--active {
  border-color: var(--color-success, #22c55e);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success, #22c55e) 20%, transparent);
}
/* Screenshot container */
.theme-card__screenshot {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #e2e8f0;
}
.theme-card__screenshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.theme-card:hover .theme-card__screenshot img {
  transform: scale(1.03);
}
/* Active badge */
.theme-card__badge {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: var(--color-success, #22c55e);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: .3rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
/* Color dots */
.theme-card__color-dots {
  position: absolute;
  bottom: .6rem;
  left: .6rem;
  display: flex;
  gap: .35rem;
}
.theme-card__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  display: inline-block;
}
/* Card body */
.theme-card__body {
  padding: .85rem 1rem .5rem;
  flex: 1;
}
.theme-card__meta {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .35rem;
}
.theme-card__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text, #0f172a);
  margin: 0;
}
.theme-card__version {
  font-size: .72rem;
  color: var(--color-text-secondary, #64748b);
  background: var(--color-border, #e2e8f0);
  padding: .1rem .4rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.theme-card__desc {
  font-size: .8rem;
  color: var(--color-text-secondary, #64748b);
  margin: 0 0 .4rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.theme-card__author {
  font-size: .75rem;
  color: var(--color-text-secondary, #64748b);
  margin: 0;
  display: flex;
  align-items: center;
}
.theme-card__author a {
  color: var(--color-primary, #4361ee);
  text-decoration: none;
}
.theme-card__author a:hover {
  text-decoration: underline;
}
/* Actions */
.theme-card__actions {
  padding: .65rem 1rem .85rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
  display: flex;
  justify-content: flex-end;
}
/* Placeholder (no screenshot) */
.theme-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.theme-card__placeholder-header {
  height: 30%;
  opacity: .85;
}
.theme-card__placeholder-body {
  flex: 1;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  justify-content: center;
}
.theme-card__placeholder-bar {
  height: 8px;
  border-radius: 4px;
}
.theme-card__placeholder-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-top: .25rem;
}
/* ── AI Theme Generator local styles ── */
.aitheme-palette {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}
.aitheme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}
.aitheme-swatch__color {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0, 0, 0, .1));
}
.aitheme-swatch__label {
  font-size: .7rem;
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.2;
}
.aitheme-swatch__hex {
  font-size: .65rem;
  color: var(--color-text-muted);
  font-family: monospace;
}
.aitheme-code-preview {
  background: var(--color-surface-bg, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-4);
  font-size: .78rem;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 340px;
  white-space: pre;
  font-family: 'Fira Code', 'Consolas', monospace;
}
.aitheme-layout-blocks {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
.aitheme-layout-col {
  flex: 1 1 200px;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  background: var(--color-surface-bg, #f3f4f6);
}
.aitheme-layout-col__head {
  font-weight: 600;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.aitheme-layout-col ul {
  margin: 0;
  padding-left: var(--space-4);
}
.aitheme-layout-col li {
  font-size: .82rem;
  line-height: 1.7;
}
.aitheme-layout-col ul:empty::after {
  content: '—';
  color: var(--color-text-muted, #9ca3af);
}
.form-row {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.form-row > div {
  min-width: 0;
}
#aitheme-status.loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: var(--space-2);
  vertical-align: middle;
}