/* ── ACSYSTEM Dashboard — Rediseño UI/UX 2026 ──── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colores — contraste alto para legibilidad */
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #21262d;
  --bg4: #30363d;
  --border: #30363d;
  --border-light: #3d444d;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #6e7681;
  --green: #3fb950;
  --green2: #238636;
  --blue: #58a6ff;
  --blue2: #1f6feb;
  --orange: #d29922;
  --red: #f85149;
  --purple: #a371f7;
  --yellow: #e3b341;
  --cyan: #39c5cf;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit; font-size: 13px;
  background: var(--bg4); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
select { cursor: pointer; }
textarea { resize: vertical; line-height: 1.6; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── SCREENS ──────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }
#app-screen { height: 100vh; }

/* ── LOGIN ────────────────────────────────────── */
#login-screen {
  justify-content: center;
  align-items: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(63,185,80,.08) 0%, transparent 60%);
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 400px;
  max-width: 92vw;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-logo {
  font-size: 2.2rem;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-box h2 { font-size: 1.3rem; margin-bottom: 4px; }
.login-box > p { color: var(--text2); font-size: .88rem; margin-bottom: 24px; }
.login-box input {
  margin-bottom: 12px;
  text-align: center;
  font-size: 15px;
  letter-spacing: 2px;
}
.login-box button {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  background: var(--green2);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  transition: background .2s, transform .1s;
}
.login-box button:hover { background: var(--green); }
.login-box button:active { transform: scale(.98); }
.error-msg {
  color: var(--red);
  font-size: .82rem;
  margin-top: 10px;
  min-height: 18px;
}

/* ── SIDEBAR ───────────────────────────────────── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.sidebar-brand {
  padding: 20px 18px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 1px solid var(--border);
  letter-spacing: -.3px;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 2px;
  overflow-y: auto;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text2);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  transition: all .15s;
  text-align: left;
  white-space: nowrap;
}
.nav-btn:hover {
  background: var(--bg3);
  color: var(--text);
}
.nav-btn.active {
  background: var(--bg3);
  color: var(--green);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--green);
}
.nav-btn .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px;
}
.sidebar-footer .nav-btn { color: var(--text3); }
.sidebar-footer .nav-btn:hover { color: var(--red); background: rgba(248,81,73,.08); }

/* ── CONTENT ──────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg);
}
.view { display: none; }
.view.active { display: block; }
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.view-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.2px;
}
.header-actions { display: flex; gap: 8px; }

/* ── BUTTONS ──────────────────────────────────── */
.btn-primary {
  background: var(--green2);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .85rem;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--green); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .85rem;
  transition: all .15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--bg4); border-color: var(--border-light); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 500;
}
.btn-danger:hover { background: var(--red); color: #fff; }

/* ── KANBAN ──────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  height: calc(100vh - 120px);
  align-items: flex-start;
}
.kanban-column {
  min-width: 290px;
  max-width: 320px;
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban-col-header h3 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text2);
}
.kanban-col-count {
  background: var(--bg3);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text3);
}
.kanban-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-col-body::-webkit-scrollbar { width: 4px; }
.kanban-col-body::-webkit-scrollbar-track { background: transparent; }
.kanban-col-body::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

/* TASK CARDS */
.kanban-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: grab;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
}
.kanban-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.sortable-ghost {
  background: var(--bg3) !important;
  border: 2px dashed var(--green) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
}

.card-title {
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 5px;
  color: var(--text);
  line-height: 1.35;
}
.card-desc {
  font-size: .8rem;
  color: var(--text2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.card-priority {
  font-size: .68rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.card-priority.critical { background: rgba(248,81,73,.15); color: var(--red); }
.card-priority.high { background: rgba(248,81,73,.1); color: #f97316; }
.card-priority.medium { background: rgba(210,153,34,.12); color: var(--orange); }
.card-priority.low { background: rgba(63,185,80,.12); color: var(--green); }

.card-tag {
  font-size: .68rem;
  background: rgba(163,113,247,.12);
  color: var(--purple);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.card-due {
  font-size: .72rem;
  color: var(--text3);
  margin-left: auto;
}

/* ── AGENTS ───────────────────────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.agent-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color .2s, box-shadow .2s;
}
.agent-card:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(63,185,80,.15);
}
.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 10px;
}
.agent-card-header h3 { font-size: 1rem; font-weight: 700; }
.agent-badge {
  font-size: .68rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  background: rgba(63,185,80,.12);
  color: var(--green);
  border: 1px solid rgba(63,185,80,.25);
  white-space: nowrap;
}
.agent-role {
  font-size: .8rem;
  color: var(--blue);
  margin-bottom: 8px;
  font-weight: 500;
}
.agent-mission {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: var(--radius);
  border-left: 3px solid var(--blue);
}
.agent-caps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.agent-cap {
  font-size: .72rem;
  background: var(--bg3);
  color: var(--text2);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.agent-rules { margin-top: 10px; }
.agent-rules li {
  font-size: .78rem;
  color: var(--text2);
  margin-left: 18px;
  margin-bottom: 3px;
  line-height: 1.4;
}

/* ── CRON ─────────────────────────────────────── */
.cron-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cron-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cron-item:hover {
  border-color: var(--blue);
  background: rgba(88,166,255,.03);
}
.cron-info { flex: 1; }
.cron-name { font-weight: 700; font-size: .95rem; margin-bottom: 5px; }
.cron-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .75rem;
  color: var(--text3);
}
.cron-details span { display: flex; align-items: center; gap: 4px; }
.cron-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cron-status {
  font-size: .72rem;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  white-space: nowrap;
}
.cron-status.ok { background: rgba(63,185,80,.12); color: var(--green); }
.cron-status.error { background: rgba(248,81,73,.12); color: var(--red); }
.cron-status.unknown { background: rgba(210,153,34,.12); color: var(--orange); }
.cron-empty { text-align: center; padding: 50px; color: var(--text3); font-size: .9rem; }

/* ── FILE EDITOR ──────────────────────────────── */
.files-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 120px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg2);
}
.files-sidebar {
  width: 280px;
  min-width: 280px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.files-sidebar::-webkit-scrollbar { width: 4px; }
.files-sidebar::-webkit-scrollbar-thumb { background: var(--bg4); }

.file-dir-header {
  padding: 10px 16px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  gap: 8px;
}
.file-item:hover { background: var(--bg3); }
.file-item.active {
  background: var(--bg3);
  border-left: 3px solid var(--green);
  padding-left: 13px;
}
.file-item-name { font-weight: 500; font-size: .85rem; }
.file-item-path { font-size: .7rem; color: var(--text3); margin-top: 1px; }
.file-item-size { font-size: .7rem; color: var(--text3); white-space: nowrap; flex-shrink: 0; }

.files-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.files-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
  min-height: 50px;
  gap: 12px;
}
#file-save-status { font-size: .78rem; color: var(--green); }
#file-editor-content {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: none;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.7;
  resize: none;
  tab-size: 2;
}
#file-editor-content:focus { outline: none; }
#file-editor-content:disabled { color: var(--text3); }

/* ── SETTINGS ─────────────────────────────────── */
.settings-panel { display: flex; flex-direction: column; gap: 14px; max-width: 680px; }
.setting-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.setting-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: 8px; }
.setting-card p { font-size: .82rem; color: var(--text2); margin-bottom: 5px; }
.setting-card code {
  background: var(--bg3);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .8rem;
  color: var(--cyan);
  font-family: var(--font-mono);
}

/* ── MODALS ────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  width: 560px;
  max-width: 94vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.15rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.5rem;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: all .15s;
  line-height: 1;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }
.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* Edit List */
.edit-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.edit-item {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.edit-item input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px;
  font-size: .85rem;
}
.edit-item input:focus { outline: none; }
.edit-item button {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  opacity: .6;
  transition: opacity .15s;
}
.edit-item button:hover { opacity: 1; }
.btn-sm {
  background: transparent;
  color: var(--green);
  border: 1px dashed var(--border);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
  margin-top: 6px;
  width: 100%;
  transition: all .15s;
}
.btn-sm:hover { background: var(--bg3); border-color: var(--green); }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 900px) {
  #sidebar { width: 58px; min-width: 58px; }
  .sidebar-brand { font-size: 0; padding: 16px 0; text-align: center; }
  .sidebar-brand::before { content: '⚡'; font-size: 1.3rem; }
  .nav-btn { font-size: 0; padding: 12px; justify-content: center; }
  .nav-btn .nav-icon { font-size: 1.2rem; }
  .sidebar-footer .nav-btn { font-size: 0; }
  .sidebar-footer .nav-icon { font-size: 1.2rem; }
  #content { padding: 16px; }
  .kanban-board { gap: 12px; }
  .agents-grid { grid-template-columns: 1fr; }
  .files-layout { flex-direction: column; height: auto; }
  .files-sidebar { width: 100%; max-height: 300px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* btn-sm-cron */
.btn-sm-cron {
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: .78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn-sm-cron:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
