:root {
      --bg-app: #f4f5f9;
      --card-bg: #ffffff;
      --text-main: #0f172a;
      --text-muted: #64748b;
      --border-light: #e2e8f0;

      --accent-pink: #ec4899;
      --accent-teal: #00d2b5;
      --accent-purple: #8b5cf6;
      --accent-amber: #f59e0b;
      --accent-blue: #0284c7;

      --radius-lg: 16px;
      --radius-md: 12px;
      --radius-pill: 9999px;

      --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
      --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    }

    * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
    body { background: var(--bg-app); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; padding: 10px; gap: 10px; }

    /* LEFT ICON SIDEBAR */
    .app-icon-bar {
      width: 60px; background: var(--card-bg); border: 1px solid var(--border-light);
      border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center;
      padding: 16px 0; gap: 18px; box-shadow: var(--shadow-sm); z-index: 100;
    }
    .app-logo {
      width: 38px; height: 38px; background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
      border-radius: 10px; display: flex; align-items: center; justify-content: center;
      color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3); cursor: pointer;
    }
    .nav-icon-btn {
      width: 38px; height: 38px; border-radius: 10px; border: none; background: transparent;
      color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
      font-size: 18px; transition: all 0.2s ease;
    }
    .nav-icon-btn:hover { background: #f1f5f9; color: var(--accent-purple); }
    .nav-icon-btn.active { background: #f3e8ff; color: var(--accent-purple); font-weight: bold; }

    /* MAIN APP WRAPPER */
    .app-main { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }

    /* TOPBAR */
    .top-bar {
      background: var(--card-bg); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
      padding: 8px 18px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm);
    }
    .page-title { font-size: 14px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
    .brand-version { background: #f1f5f9; color: var(--text-muted); font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }

    .top-actions { display: flex; gap: 8px; align-items: center; }

    /* BUTTONS PIKU STYLE */
    .btn {
      height: 34px; padding: 0 14px; border: 1px solid var(--border-light); background: #ffffff;
      color: var(--text-main); border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
      cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s ease;
      box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    }
    .btn:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--accent-purple); transform: translateY(-1px); }

    .btn-pink {
      background: linear-gradient(135deg, #ec4899, #d946ef); color: #ffffff; border: none;
      box-shadow: 0 4px 14px rgba(236, 72, 153, 0.3); font-weight: 700;
    }
    .btn-pink:hover { color: #fff; opacity: 0.95; transform: translateY(-1px); }

    .btn-teal {
      background: var(--accent-teal); color: #ffffff; border: none; font-weight: 700;
      box-shadow: 0 4px 12px rgba(0, 210, 181, 0.25);
    }
    .btn-teal:hover { color: #fff; opacity: 0.95; }

    .btn-drive { background: #ffffff; border: 1px solid #cbd5e1; color: var(--text-main); font-weight: 600; }
    .btn-drive:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

    .btn-danger { background: #ef4444; color: #fff; border: none; font-weight: 600; }
    .btn-danger:hover { background: #dc2626; color: #fff; }

    .btn-toggle { background: #f1f5f9; border-color: var(--border-light); color: var(--text-muted); }
    .btn-toggle.active { background: var(--accent-purple); color: #ffffff; border-color: var(--accent-purple); font-weight: 700; }

    .screen-tabs { display: flex; gap: 4px; background: #f1f5f9; padding: 3px; border-radius: var(--radius-pill); }
    .tab-btn { background: transparent; border: none; color: var(--text-muted); padding: 5px 14px; font-size: 11px; font-weight: 700; border-radius: var(--radius-pill); cursor: pointer; transition: all 0.2s; }
    .tab-btn.active { background: #ffffff; color: var(--accent-purple); box-shadow: var(--shadow-sm); }

    /* Dropdown "Tools" */
    .dropdown { position: relative; }
    .dropdown-menu {
      position: absolute; top: 100%; right: 0; margin-top: 6px;
      background: #ffffff; border: 1px solid var(--border-light); border-radius: 12px;
      box-shadow: var(--shadow-md); display: none;
      flex-direction: column; min-width: 190px; z-index: 100; overflow: hidden; padding: 6px;
    }
    .dropdown-menu.show { display: flex; }
    .dropdown-item {
      padding: 8px 12px; background: transparent; border: none; color: var(--text-main);
      font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; display: flex;
      align-items: center; gap: 8px; border-radius: 6px; transition: background 0.15s;
    }
    .dropdown-item:hover { background: #faf5ff; color: var(--accent-purple); }

    /* WORKSPACE CONTAINER */
    .workspace-container { flex: 1; display: flex; flex-direction: column; min-height: 0; transition: all 0.3s ease; }
    .workspace-container.minimized { flex: 0 !important; height: 0 !important; opacity: 0; pointer-events: none; overflow: hidden; }

    .screen-view { display: none; flex: 1; gap: 10px; min-height: 0; }
    .screen-view.active { display: flex; }

    /* PANELS (STUDIO) */
    .panel { display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
    .panel-header { padding: 12px 16px; background: #ffffff; color: var(--text-main); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-light); }
    .btn-collapse { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 2px 4px; border-radius: 4px; transition: background 0.15s, color 0.15s; }
    .btn-collapse:hover { background: #f1f5f9; color: var(--accent-purple); }
    .panel.collapsed { display: none !important; }

    .seo-panel { width: 310px; min-width: 290px; }
    .seo-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; flex: 1; }

    .score-box { background: #0f172a; color: #fff; border-radius: var(--radius-md); padding: 14px; display: flex; align-items: center; gap: 12px; }
    .score-circle { width: 50px; height: 50px; border-radius: 50%; background: #10b981; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; transition: all 0.3s ease; }

    .seo-field { display: flex; flex-direction: column; gap: 4px; }
    .seo-field label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; display: flex; justify-content: space-between; }
    .seo-field input, .seo-field select { padding: 8px 12px; border: 1px solid var(--border-light); background: #f8fafc; border-radius: 8px; font-size: 12px; color: var(--text-main); outline: none; transition: border-color 0.15s; }
    .seo-field input:focus, .seo-field select:focus { border-color: var(--accent-purple); background: #fff; }

    .checklist { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border-light); padding-top: 10px; }
    .check-item { font-size: 11px; display: flex; align-items: flex-start; gap: 6px; line-height: 1.4; color: #334155; }
    .check-pass { color: #10b981; font-weight: bold; }
    .check-fail { color: #ef4444; font-weight: bold; }
    .check-warn { color: #f59e0b; font-weight: bold; }

    /* BOX AGENDAMENTO & TAGS */
    .agendamento-box {
      border-bottom: 1px solid var(--border-light);
      background: #f8fafc;
      padding: 10px 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .agendamento-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-weight: 700;
      font-size: 11px;
      text-transform: uppercase;
      color: var(--text-main);
      cursor: pointer;
      user-select: none;
    }
    .agendamento-body {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 6px;
      transition: all 0.2s ease;
    }
    .agendamento-body.collapsed { display: none; }

    /* NUVEM DE PALAVRAS SECUNDÁRIAS */
    .sec-kw-cloud {
      padding: 10px 14px;
      background: #f8fafc;
      border-bottom: 1px solid var(--border-light);
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
    }
    .sec-kw-label {
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-right: 4px;
    }
    .kw-pill {
      padding: 3px 10px;
      border-radius: var(--radius-pill);
      background: #e2e8f0;
      color: #475569;
      font-size: 11px;
      font-weight: 600;
      transition: all 0.2s ease;
      border: 1px solid #cbd5e1;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .kw-pill.used {
      background: #dcfce7 !important;
      color: #15803d !important;
      border-color: #86efac !important;
      font-weight: 700;
      box-shadow: 0 1px 4px rgba(22, 163, 74, 0.15);
    }

    /* EDITOR VISUAL */
    .editor-panel { flex: 1; position: relative; }
    .wp-toolbar { padding: 8px 12px; background: #ffffff; border-bottom: 1px solid var(--border-light); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
    .wp-toolbar button, .wp-toolbar select { height: 32px; padding: 0 10px; border: 1px solid var(--border-light); background: #ffffff; color: var(--text-main); border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
    .wp-toolbar button:hover { background: #f8fafc; border-color: var(--accent-purple); color: var(--accent-purple); }

    .editor { flex: 1; padding: 28px 36px; outline: none; overflow-y: auto; font-size: 15px; color: var(--text-main); background: #ffffff; line-height: 1.75; box-sizing: border-box; }
    .editor h1, .editor h2, .editor h3 { font-weight: 800; color: #0f172a; margin-top: 1.2em; margin-bottom: 0.5em; }
    .editor p { margin-bottom: 1.2em; }
    .editor a { color: var(--accent-purple); text-decoration: underline; font-weight: 600; }

    /* HTML CODE PANEL */
    .code-panel { flex: 1; }
    .code-container { position: relative; flex: 1; background: #0f172a; overflow: hidden; }
    .code-input, .code-highlight {
      position: absolute; top: 0; left: 0; width: 100%; height: 100%;
      padding: 16px !important; margin: 0 !important; border: 0 !important; outline: none !important;
      font-family: 'JetBrains Mono', monospace !important; font-size: 12px !important; line-height: 1.6 !important;
      letter-spacing: normal !important; white-space: pre-wrap !important; word-break: break-all !important;
      box-sizing: border-box !important; tab-size: 2 !important;
    }
    .code-input { color: transparent; background: transparent; caret-color: #38bdf8; resize: none; z-index: 2; overflow-y: auto; }
    .code-highlight { z-index: 1; color: #e2e8f0; pointer-events: none; overflow: hidden; }

    .hl-tag { color: #38bdf8; font-weight: bold; }
    .hl-attr { color: #93c5fd; }
    .hl-str { color: #fde047; }
    .hl-comment { color: #4ade80; font-style: italic; }
    mark.hl-selection { background: #1e3a8a !important; color: #ffffff !important; border-radius: 2px; outline: 1px solid #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.5); padding: 0 !important; margin: 0 !important; display: inline !important; }

    /* MODAL DE HUMANIZAÇÃO */
    .piku-modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 2000; }
    .piku-modal-window { background: var(--bg-app); border-radius: var(--radius-lg); width: 85vw; max-width: 950px; height: 75vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25); border: 1px solid var(--border-light); }

    .piku-modal-top { background: #ffffff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-light); }
    .piku-modal-title { font-size: 15px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 8px; }

    .piku-modal-body { padding: 20px; flex: 1; display: flex; gap: 16px; min-height: 0; }

    .piku-main-area { flex: 1; background: #ffffff; border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-sm); min-height: 0; }

    .piku-compare-box { flex: 1; border: 1px solid #e2e8f0; border-radius: var(--radius-lg); background: #fdfdfe; display: flex; overflow: hidden; position: relative; }
    .piku-col { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; position: relative; }
    .piku-col-left { border-right: 1px solid #f1f5f9; background: #f8fafc; }

    .piku-col-title { font-size: 14px; font-weight: 800; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
    .piku-text-content { font-size: 14px; line-height: 1.8; color: #334155; outline: none; }
    .piku-text-content.read-only { color: #64748b; user-select: text; cursor: default; }

    .piku-badge-float {
      position: absolute; padding: 8px 18px; border-radius: var(--radius-pill); font-size: 12px;
      font-weight: 700; color: #0f172a; display: inline-flex; align-items: center; gap: 6px;
      box-shadow: 0 4px 14px rgba(0,0,0,0.12); cursor: pointer; transition: transform 0.15s;
    }
    .piku-badge-float:hover { transform: scale(1.05); }
    .badge-amber { background: #ffc107; bottom: 20px; right: 20px; }

    .piku-actions-bar { display: flex; gap: 12px; color: var(--text-muted); font-size: 13px; margin-top: auto; }
    .piku-action-icon { cursor: pointer; transition: color 0.15s; }
    .piku-action-icon:hover { color: var(--accent-purple); }

    /* CALENDÁRIO VISUAL & PLANEJADOR */
    .calendar-container { flex: 1; display: flex; flex-direction: column; gap: 12px; background: #ffffff; border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 18px; overflow-y: auto; }
    .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; flex: 1; auto-rows: minmax(100px, 1fr); }
    .cal-day-header { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; text-align: center; padding: 6px 0; background: #f8fafc; border-radius: 6px; }
    .cal-day-cell { background: #ffffff; border: 1px solid var(--border-light); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-height: 95px; }
    .cal-item-card { font-size: 10px; font-weight: 700; padding: 4px 6px; border-radius: 6px; background: #f1f5f9; border-left: 3px solid var(--accent-purple); cursor: pointer; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

    .planner-layout { flex: 1; display: flex; gap: 14px; min-height: 0; }
    .planner-sidebar { width: 340px; background: #ffffff; border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
    .planner-content { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }

    .table-container { flex: 1; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 8px; background: #fff; }
    .link-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; table-layout: fixed; }
    .link-table th { background: #0f172a; color: #f8fafc; padding: 10px 12px; font-size: 11px; text-transform: uppercase; font-weight: 700; position: sticky; top: 0; z-index: 5; }
    .link-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; word-break: break-all; vertical-align: middle; }

    .tags-wrapper { display: flex; flex-wrap: wrap; gap: 4px; }
    .anchor-tag { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; }

    /* WINDOWS TASKBAR */
    .windows-taskbar { height: 36px; background: var(--card-bg); border-radius: var(--radius-lg); border: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; padding: 0 12px; box-shadow: var(--shadow-sm); }
    .taskbar-left { display: flex; gap: 6px; }
    .taskbar-item { height: 26px; padding: 0 12px; background: #f1f5f9; border: none; color: var(--text-muted); border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; cursor: pointer; }
    .taskbar-item.active { background: var(--accent-purple); color: #fff; }

    .taskbar-status { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

    /* MODAL DO BANCO DE BACKLINKS */
    .modal { background: #ffffff; border-radius: var(--radius-lg); width: 92vw; max-width: 1000px; height: 82vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid var(--border-light); }
    .modal-header { background: #0f172a; color: #fff; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; }
    .modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; background: #f8fafc; }

    .link-popover { position: absolute; background: #ffffff; border: 1px solid var(--border-light); border-radius: 10px; box-shadow: var(--shadow-md); display: none; flex-direction: column; z-index: 50; min-width: 240px; font-size: 12px; }
    .link-popover.show { display: flex; }
    .link-popover-url { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; color: var(--text-muted); font-family: monospace; font-size: 11px; }
    .link-popover-actions { display: flex; padding: 4px; background: #f8fafc; border-radius: 0 0 10px 10px; }
    .pop-btn { flex: 1; background: transparent; border: none; padding: 6px; font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 6px; }
    .pop-btn:hover { background: #e2e8f0; color: var(--accent-purple); }
