/* OMNI-MARKETING-OS – UI v2 (polished) */

:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.12);
  --bg: #f1f5f9;
  --sidebar-bg: #0b1220;
  --sidebar-bg-2: #111827;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-active-bg: linear-gradient(90deg, rgba(59,130,246,.25), rgba(59,130,246,.06));
  --sidebar-active-border: #3b82f6;
  --sidebar-section: #64748b;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --form-border: #4287f5;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --sidebar-width: 268px;
  --topbar-h: 56px;
  --font: "Be Vietnam Pro", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Vietnamese", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(59,130,246,.35), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(34,211,238,.18), transparent 50%),
    linear-gradient(160deg, #0b1220 0%, #0f172a 45%, #1e293b 100%);
  position: relative;
}
.login-page .lang-switch { position: absolute; top: 1.25rem; right: 1.25rem; }
.login-page .lang-switch a {
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(15,23,42,.35);
}
.login-page .lang-switch a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.login-box {
  background: rgba(255,255,255,.98);
  padding: 2.25rem 2rem;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-box .logo {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
}
.login-box .tagline {
  text-align: center;
  color: var(--muted);
  font-size: .875rem;
  margin: .35rem 0 1.5rem;
}
.login-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--form-border, #4287f5);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4287f5;
  box-shadow: 0 0 0 3px rgba(66, 135, 245, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .55rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all .15s ease;
}
.btn:hover { background: #f8fafc; border-color: var(--border-strong); }
.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn.primary:hover { background: var(--primary-hover); color: #fff; }
.btn.block { width: 100%; }
.btn.small { padding: .3rem .65rem; font-size: .78rem; }

.links { margin-top: 1rem; text-align: center; font-size: .85rem; color: var(--muted); }
.links a { color: var(--primary); font-weight: 500; }

.lang-switch a {
  display: inline-block;
  padding: .2rem .5rem;
  margin-left: .2rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}
.lang-switch a.active { background: var(--primary); color: #fff; }

/* LAYOUT */
.app-layout { min-height: 100vh; background: var(--bg); }

.topbar {
  height: var(--topbar-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .left { display: flex; align-items: center; gap: 1.25rem; }
.topbar .logo { font-weight: 800; font-size: .95rem; letter-spacing: -0.02em; }
.topbar .project-selector {
  font-size: .85rem;
  color: var(--muted);
  padding: .35rem .7rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.topbar .project-selector strong { color: var(--text); font-weight: 600; }
.topbar .project-selector .switch { margin-left: .25rem; color: var(--muted); }
.topbar .right { display: flex; align-items: center; gap: .75rem; }
.topbar .user { font-size: .85rem; font-weight: 600; color: var(--text-secondary); }

.main-wrapper {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

/* SIDEBAR – nổi bật active */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  padding: .85rem 0 1.5rem;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .55rem; }
.sidebar .section {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sidebar-section);
  padding: 1rem .75rem .35rem;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .75rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar a .nav-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.sidebar a .nav-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.25;
  color: inherit;
}
.sidebar a .nav-desc {
  display: block;
  font-size: .65rem;
  font-weight: 400;
  opacity: 0.7;
  line-height: 1.25;
  color: inherit;
  white-space: normal;
  word-break: break-word;
}
.sidebar a:hover {
  background: rgba(255,255,255,.06);
  color: var(--sidebar-text-hover);
}
.sidebar a.active {
  background: var(--sidebar-active-bg);
  color: #fff !important;
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59,130,246,.18);
}
.sidebar a.active .nav-label {
  font-weight: 600;
}
.sidebar a.active .nav-desc {
  opacity: 0.85;
}
.sidebar .nav-bundle {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 2px;
}
.sidebar .nav-bundle.open {
  background: rgba(255,255,255,.03);
  border-radius: 10px;
  padding-bottom: 4px;
}
.sidebar a.nav-sub {
  padding: .28rem .75rem .32rem 1.35rem;
  font-weight: 500;
}
.sidebar a.nav-sub .nav-label {
  font-size: .78rem;
}
.sidebar a.nav-sub .nav-desc {
  font-size: .6rem;
}

.content {
  flex: 1;
  padding: 1.35rem 1.5rem 2rem;
  min-width: 0;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.page-header p, .page-header .subtitle {
  font-size: .875rem;
  color: var(--muted);
  margin-top: .2rem;
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.kpi-card .label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kpi-card .value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: .35rem 0 .15rem;
}
.kpi-card .value.up { color: var(--success); }
.kpi-card .value.down { color: var(--danger); }
.kpi-card .sub { font-size: .82rem; color: var(--muted); }

.chart-placeholder {
  background: var(--card-bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.25rem;
}

.section-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .85rem;
}
.section-header h2 { font-size: 1rem; font-weight: 700; }
.section-header a { font-size: .82rem; font-weight: 600; color: var(--primary); }

.task-list, .activity-list { list-style: none; }
.task-list li, .activity-list li {
  padding: .65rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: .9rem;
  color: var(--text-secondary);
}
.task-list li:last-child, .activity-list li:last-child { border-bottom: none; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 700;
  background: #e0e7ff;
  color: #3730a3;
  margin-right: .5rem;
}
.priority-high { border-left: 3px solid var(--danger); padding-left: .75rem; }
.priority-medium { border-left: 3px solid var(--warning); padding-left: .75rem; }
.priority-low { border-left: 3px solid #94a3b8; padding-left: .75rem; }

/* GROUP */
.group-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.15rem;
}
@media (max-width: 900px) {
  .group-layout { grid-template-columns: 1fr; }
}
.bot-list {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.bot-list h3 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: .75rem;
}
.bot-item {
  display: block;
  padding: .7rem .75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  margin-bottom: .3rem;
}
.bot-item:hover { background: #f8fafc; border-color: var(--border); }
.bot-name { font-weight: 600; font-size: .9rem; }
.bot-meta { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.tag {
  background: #dbeafe;
  color: #1d4ed8;
  padding: .1rem .4rem;
  border-radius: 4px;
  margin-left: .35rem;
  font-weight: 600;
  font-size: .7rem;
}
.bot-preview {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  color: var(--muted);
}

/* BOT 6 TABS */
.bot-tabs {
  display: flex;
  gap: .15rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.15rem;
  overflow-x: auto;
}
.bot-tabs a,
.bot-tabs button,
.bot-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: .7rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  margin-bottom: -1px;
}
.bot-tabs a:hover,
.bot-tabs button:hover,
.bot-tab:hover { color: var(--text); }
.bot-tabs a.active,
.bot-tabs button.active,
.bot-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* PROJECTS */
.projects-page .container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
}
.project-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.project-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 8px 24px rgba(37,99,235,.08);
}
.project-card h3 { margin-bottom: .25rem; }
.project-card .domain { color: var(--primary); font-size: .9rem; font-weight: 500; }
.project-card .meta,
.project-card .updated { font-size: .8rem; color: var(--muted); margin: .5rem 0; }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  background: white;
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-content h2 { margin-bottom: 1.25rem; font-weight: 800; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.25rem;
}

.muted, .empty { color: var(--muted); }
.ok { color: var(--success); font-weight: 600; }

.page-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.page-card h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 700; }
.meta-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: .45rem .85rem;
  font-size: .9rem;
}
.meta-grid .k { color: var(--muted); font-weight: 500; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td {
  text-align: left;
  padding: .6rem .45rem;
  border-bottom: 1px solid #f1f5f9;
}
.table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,.25);
  border-radius: 99px;
}


/* form border unify – all inputs/selects/textareas */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
input:not([type]),
select,
textarea {
  border: 1px solid #4287f5 !important;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #4287f5 !important;
  box-shadow: 0 0 0 3px rgba(66, 135, 245, 0.2) !important;
  outline: none;
}

/* CSKH: hide sidebar, full content */
body.cskh-mode .main-wrapper {
  display: block;
}
body.cskh-mode .sidebar {
  display: none !important;
}
body.cskh-mode .main-wrapper > .content,
body.cskh-mode main.content {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100%;
}


/* cskh-mode mobile topbar 20260911_qr */
@media (max-width: 900px) {
  body.cskh-mode .topbar {
    padding: .45rem .65rem;
    flex-wrap: wrap;
    gap: .35rem;
  }
  body.cskh-mode .topbar .left {
    min-width: 0;
    flex: 1 1 auto;
  }
  body.cskh-mode .topbar .logo {
    font-size: .82rem;
    line-height: 1.25;
    max-width: 58vw;
    white-space: normal;
  }
  body.cskh-mode main.content {
    padding: .45rem .5rem .35rem !important;
  }
}
