  :root {
    --bg: #0f0f11;
    --surface: #18181c;
    --surface2: #222228;
    --border: rgba(255,255,255,0.08);
    --border2: rgba(255,255,255,0.14);
    --text: #f0f0f2;
    --text2: #9999aa;
    --text3: #666675;
    --accent: #7c6ff7;
    --accent2: #a89ff9;
    --accent-bg: rgba(124,111,247,0.12);
    --success: #3ecf8e;
    --success-bg: rgba(62,207,142,0.1);
    --danger: #f66;
    --danger-bg: rgba(255,102,102,0.1);
    --warn: #f5a623;
    --warn-bg: rgba(245,166,35,0.1);
  }

  [data-theme="light"] {
    --bg: #f4f4f6;
    --surface: #ffffff;
    --surface2: #f0f0f3;
    --border: rgba(0,0,0,0.08);
    --border2: rgba(0,0,0,0.14);
    --text: #111114;
    --text2: #555560;
    --text3: #999aaa;
    --accent: #6355e8;
    --accent2: #5045cc;
    --accent-bg: rgba(99,85,232,0.08);
    --success: #1ea974;
    --success-bg: rgba(30,169,116,0.1);
    --danger: #e03030;
    --danger-bg: rgba(224,48,48,0.08);
    --warn: #d4880a;
    --warn-bg: rgba(212,136,10,0.08);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
  }

  /* LOCK SCREEN */
  #lockScreen {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
  }
  .lock-box {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 16px;
    padding: 48px 40px;
    width: 380px;
    text-align: center;
  }
  .lock-logo {
    width: 48px; height: 48px;
    background: var(--accent-bg);
    border: 1px solid rgba(124,111,247,0.3);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 24px;
    font-size: 22px;
  }
  .lock-box h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
  .lock-box p { color: var(--text2); font-size: 13px; margin-bottom: 28px; }
  .rte-wrap { border: 1px solid var(--border2); border-radius: 8px; overflow: hidden; background: var(--surface); }
  .rte-toolbar { display: flex; gap: 2px; padding: 4px 6px; background: var(--surface2); border-bottom: 1px solid var(--border2); }
  .rte-toolbar button { background: none; border: 1px solid transparent; border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 13px; color: var(--text2); font-family: inherit; line-height: 1.4; }
  .rte-toolbar button:hover { background: var(--border); }
  .rte-editor { min-height: 100px; max-height: 200px; overflow-y: auto; padding: 8px 12px; font-size: 13px; color: var(--text); outline: none; line-height: 1.6; }
  .rte-editor:empty:before { content: attr(data-placeholder); color: var(--text3); pointer-events: none; }
  .rte-editor b, .rte-editor strong { font-weight: 700; }
  .rte-editor i, .rte-editor em { font-style: italic; }
  .rte-editor u { text-decoration: underline; }
  .rte-editor ul { padding-left: 20px; }
  .lock-input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
  }
  .lock-input:focus { border-color: var(--accent); }
  .lock-error { color: var(--danger); font-size: 12px; margin-bottom: 10px; min-height: 16px; }

  /* APP SHELL */
  #app { display: none; min-height: 100vh; }
  
  /* SIDEBAR */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex; flex-direction: column;
    z-index: 100;
  }
  .sidebar-brand {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    flex-shrink: 0;
  }
  .brand-logo {
    display: flex; align-items: center; gap: 10px;
  }
  .brand-icon {
    width: 32px; height: 32px;
    background: var(--accent-bg);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
  }
  .brand-name { font-weight: 600; font-size: 13px; color: var(--text); }
  .brand-sub { font-size: 11px; color: var(--text3); }
  
  .nav-section { padding: 0 12px 8px; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
  .nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); padding: 0 8px; margin-bottom: 4px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text2);
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s;
    border: none; background: none; width: 100%; text-align: left;
  }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { background: var(--accent-bg); color: var(--accent2); font-weight: 500; }
  .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
  .nav-item.active svg { opacity: 1; }

  .sidebar-footer {
    margin-top: auto;
    padding: 16px 20px 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }
  .sidebar-footer p { font-size: 11px; color: var(--text3); }

  /* MAIN */
  .main { margin-left: 220px; padding: 32px 40px; max-width: 1100px; }

  /* AI Assistant full-screen (νέο παράθυρο, χωρίς μενού, full width/height) */
  body.ai-fullscreen .sidebar,
  body.ai-fullscreen .sidebar-backdrop,
  body.ai-fullscreen .hamburger-btn { display: none !important; }
  body.ai-fullscreen .main { margin-left: 0; padding: 0; max-width: none; }
  body.ai-fullscreen #page-ai-assistant > div { height: 100vh !important; border: none !important; border-radius: 0 !important; }
  .ai-fs-open-btn { display: flex; }
  body.ai-fullscreen .ai-fs-open-btn { display: none !important; }

  .nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text3);
    padding: 16px 12px 6px;
    margin-top: 4px;
  }
  .nav-collapsible { margin: 2px 0; }
  .nav-section-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 7px 10px 7px 12px;
    background: none; border: none; cursor: pointer;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text3);
    font-family: inherit; border-radius: 6px;
    transition: background 0.15s;
  }
  .nav-section-toggle:hover { background: var(--surface2); color: var(--text2); }
  .nav-section-toggle.open { color: var(--accent2); }
  .nav-section-toggle.open .nav-chevron { transform: rotate(180deg); }
  .nav-section-items { padding-left: 4px; }
  .nav-section-items .nav-item { font-size: 12px; padding: 7px 10px; }
  .task-view-btn{padding:7px 14px;border:none;border-radius:7px;cursor:pointer;font-family:var(--font);font-size:12px;font-weight:500;color:var(--text2);background:transparent;transition:all 0.15s}
  .task-view-btn.active{background:var(--surface);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,0.15)}
  .task-sub-btn{padding:5px 12px;border:none;border-radius:6px;cursor:pointer;font-family:var(--font);font-size:12px;font-weight:500;color:var(--text2);background:transparent;transition:all 0.15s}
  .task-sub-btn.active{background:var(--surface);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,0.12)}
  .task-card{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:12px;margin-bottom:8px;cursor:pointer;transition:border-color 0.15s}
  .task-card:hover{border-color:var(--accent)}
  .task-card.done{opacity:0.6}
  .kanban-col{background:var(--surface2);border-radius:12px;padding:12px;min-height:200px;flex:1;min-width:0}
  .month-cell{min-height:80px;border:1px solid var(--border);border-radius:6px;padding:6px;background:var(--surface);cursor:pointer;transition:background 0.1s}
  .month-cell:hover{background:var(--surface2)}
  .month-cell.today{border-color:var(--accent);background:var(--accent-bg)}
  .month-cell.other-month{opacity:0.4}
  .task-badge{display:inline-block;padding:2px 6px;border-radius:10px;font-size:10px;font-weight:600;margin:1px;cursor:pointer;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .admin-tab{
    padding: 8px 16px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    background: transparent;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .admin-tab:hover { background: var(--surface); color: var(--text); }
  .admin-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
  .task-view-btn { padding:7px 14px;border:none;border-radius:7px;cursor:pointer;font-family:var(--font);font-size:12px;font-weight:500;color:var(--text2);background:transparent;transition:all 0.15s; }
  .task-view-btn:hover { background:var(--surface);color:var(--text); }
  .task-view-btn.active { background:var(--surface);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,0.15); }
  .admin-tab-content { display: none; }
  .admin-tab-content.active { display: block; }
  .report-tab { background:none;border:none;border-bottom:2px solid transparent;padding:8px 16px;font-size:13px;font-weight:500;color:var(--text3);cursor:pointer;font-family:inherit;transition:all 0.15s;margin-bottom:-1px; }
  .report-tab:hover { color:var(--text); }
  .report-tab.active { color:var(--accent2);border-bottom-color:var(--accent2); }
  .report-tab-content { display:none; }
  .report-tab-content.active { display:block; }
  .report-kpi { background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:18px 20px; }
  .report-kpi-value { font-size:28px;font-weight:700;color:var(--text);line-height:1.1; }
  .report-kpi-label { font-size:12px;color:var(--text3);margin-top:4px; }
  .report-kpi-delta { font-size:11px;font-weight:600;margin-top:6px; }
  .page { display: none; }
  .page.active { display: block; }
  
  .page-header { margin-bottom: 28px; }
  .page-header h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
  .page-header p { color: var(--text2); font-size: 13px; }

  /* CARDS */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
  }
  .card-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
  }
  .card-title svg { width: 15px; height: 15px; color: var(--accent2); }

  /* FORM ELEMENTS */
  label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
  input, select, textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
  }
  input:focus, select:focus, textarea:focus { border-color: var(--accent); }
  select option { background: var(--surface2); }
  textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
  .form-group { margin-bottom: 16px; }
  
  /* BUTTONS */
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px; font-weight: 500;
    cursor: pointer; border: none;
    transition: all 0.15s;
  }
  .btn svg { width: 15px; height: 15px; }
  .btn-primary { background: var(--accent); color: white; }
  .btn-primary:hover { background: #8f82f9; }
  .btn-primary:active { transform: scale(0.98); }
  .btn-secondary { background: var(--surface2); color: var(--text2); border: 1px solid var(--border2); }
  .btn-secondary:hover { color: var(--text); border-color: var(--border2); background: var(--surface); }
  .btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,102,102,0.2); }
  .btn-danger:hover { background: rgba(255,102,102,0.2); }
  .btn-sm { padding: 7px 12px; font-size: 12px; }
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* BADGE */
  .badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 500;
  }
  .badge-purple { background: var(--accent-bg); color: var(--accent2); }
  .badge-green { background: var(--success-bg); color: var(--success); }
  .badge-red { background: var(--danger-bg); color: var(--danger); }

  /* BRAND TABLE */
  .brand-table { width: 100%; border-collapse: collapse; }
  .brand-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); font-weight: 500; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
  .brand-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
  .brand-table tr:last-child td { border-bottom: none; }
  .brand-table tr:hover td { background: rgba(255,255,255,0.02); }
  .brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }

  /* TOGGLE CHIPS */
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border2);
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    color: var(--text2);
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.15s;
  }
  .chip:hover { border-color: var(--accent); color: var(--accent2); }
  .chip.selected { background: var(--accent-bg); border-color: rgba(124,111,247,0.4); color: var(--accent2); }

  /* DRIVE INPUT */
  .drive-upload-area {
    border: 1.5px dashed var(--border2);
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
  }
  .drive-upload-area:hover { border-color: var(--accent); background: var(--accent-bg); }
  .drive-upload-area svg { width: 28px; height: 28px; color: var(--text3); margin-bottom: 10px; }
  .drive-upload-area p { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
  .drive-upload-area small { font-size: 11px; color: var(--text3); }

  .image-list { display: flex; flex-direction: column; gap: 8px; }
  .image-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
  }
  .image-item-icon { font-size: 18px; }
  .image-item-info { flex: 1; min-width: 0; }
  .image-item-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-family: 'DM Mono', monospace; }
  .image-item-url { color: var(--text3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .image-item-remove { cursor: pointer; color: var(--text3); background: none; border: none; padding: 2px; transition: color 0.15s; }
  .image-item-remove:hover { color: var(--danger); }
  .image-item-remove svg { width: 14px; height: 14px; }

  /* SOCIAL NETWORK SELECTOR */
  .network-grid { display: flex; flex-wrap: wrap; gap: 10px; }
  .network-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border2);
    cursor: pointer;
    font-size: 12px; font-weight: 500;
    color: var(--text2);
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.15s;
  }
  .network-chip:hover { border-color: var(--border2); background: var(--surface2); }
  .network-chip.selected { background: var(--accent-bg); border-color: rgba(124,111,247,0.4); color: var(--accent2); }
  .net-dot { width: 8px; height: 8px; border-radius: 50%; }

  /* CAPTION PREVIEW */
  .caption-preview {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    min-height: 100px;
    white-space: pre-wrap;
    font-family: 'DM Sans', sans-serif;
  }
  .caption-placeholder { color: var(--text3); font-style: italic; }

  /* STATUS */
  .status-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 16px;
  }
  .status-bar.success { background: var(--success-bg); border: 1px solid rgba(62,207,142,0.2); color: var(--success); }
  .status-bar.error { background: var(--danger-bg); border: 1px solid rgba(255,102,102,0.2); color: var(--danger); }
  .status-bar.loading { background: var(--accent-bg); border: 1px solid rgba(124,111,247,0.2); color: var(--accent2); }
  .status-bar svg { width: 16px; height: 16px; flex-shrink: 0; }

  /* DIVIDER */
  .divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

  /* STEP indicator */
  .steps { display: flex; align-items: center; gap: 0; margin-bottom: 32px; }
  .step-item { display: flex; align-items: center; gap: 10px; }
  .step-num {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    border: 1.5px solid var(--border2);
    color: var(--text3);
  }
  .step-item.active .step-num { background: var(--accent); border-color: var(--accent); color: white; }
  .step-item.done .step-num { background: var(--success-bg); border-color: var(--success); color: var(--success); }
  .step-label { font-size: 12px; color: var(--text3); }
  .step-item.active .step-label { color: var(--text); font-weight: 500; }
  .step-line { flex: 1; height: 1px; background: var(--border); margin: 0 12px; max-width: 60px; }

  /* API config info */
  .mono { font-family: 'DM Mono', monospace; font-size: 12px; }

  /* Spinner */
  .spinner { width: 16px; height: 16px; border: 2px solid rgba(124,111,247,0.3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ===== MOBILE TOP BAR + DRAWER (hidden on desktop) ===== */
  .mobile-topbar { display: none; }
  .sidebar-backdrop { display: none; }

  /* Responsive tweaks */
  @media (max-width: 768px) {
    .mobile-topbar {
      display: flex; align-items: center; gap: 12px;
      position: fixed; top: 0; left: 0; right: 0; height: 56px;
      padding: 0 14px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      z-index: 95;
    }
    .hamburger-btn {
      background: none; border: none; cursor: pointer;
      color: var(--text); padding: 6px; margin-left: -6px;
      display: flex; align-items: center;
    }
    .hamburger-btn svg { width: 24px; height: 24px; }
    .mobile-topbar-title {
      display: flex; align-items: center; gap: 8px;
      font-size: 14px; font-weight: 600; color: var(--text);
    }
    .mobile-topbar-title .brand-icon { width: 28px; height: 28px; font-size: 14px; }

    .sidebar {
      width: 264px;
      transform: translateX(-100%);
      transition: transform 0.25s ease;
      box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-backdrop {
      display: block;
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.5);
      z-index: 99;
      opacity: 0; pointer-events: none;
      transition: opacity 0.25s ease;
    }
    .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

    .main {
      margin-left: 0;
      padding: 72px 16px 24px;
      max-width: 100%;
    }
    .form-row { grid-template-columns: 1fr; }

    /* Phase 2: lists/tables on mobile (classes set by mobile grid classifier in core.js) */
    .m-grid-stack { grid-template-columns: minmax(0, 1fr) !important; min-width: 0; }
    .m-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; max-width: 100%; }
    .m-grid-row { min-width: var(--mw, max-content); }
    .main table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    /* Phase 3: modals near-full-screen on mobile. Όλα τα overlays έχουν id που
       τελειώνει σε "Modal" (στατικά + customerFormModal) ή .persona-modal-overlay
       (modalShell). Στοιχίζουμε από πάνω, scroll όλο το overlay, box σε πλήρες
       πλάτος με λιγότερο padding. Form grids μέσα στοιβάζονται από τον classifier. */
    [id$="Modal"], .persona-modal-overlay {
      align-items: flex-start !important;
      overflow-y: auto !important;
      padding: 16px 10px !important;
    }
    [id$="Modal"] > div, .persona-modal-overlay > div {
      width: 100% !important;
      max-width: 100% !important;
      max-height: none !important;
      padding: 20px !important;
    }
  }
  @media print {
    body > * { display: none !important; }
    #invoice-print-area { display: block !important; position: fixed; top: 0; left: 0; width: 100%; background: white; z-index: 99999; }
  }

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