* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #191919;
  --bg2: #1e1e1e;
  --bg3: #262626;
  --bg-hover: #2a2a2a;
  --border: #2e2e2e;
  --border-light: #333333;
  --text: #e3e3e3;
  --text2: #a0a0a0;
  --text3: #6b6b6b;
  --primary: #e3e3e3;
  --primary-hover: #ffffff;
  --accent: #c084fc;
  --accent-dim: rgba(192, 132, 252, 0.1);
  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.1);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.1);
  --radius: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* LOGIN */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.25rem;
  width: 100%;
  max-width: 360px;
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-header p {
  color: var(--text3);
  margin-top: 0.2rem;
  font-size: 0.82rem;
}

/* FORMS */
.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 0.3rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.45rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: #505050;
}

input::placeholder, textarea::placeholder {
  color: var(--text3);
}

.textarea-full {
  resize: vertical;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}

.error-msg {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 0.75rem;
  text-align: center;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 450;
  font-family: inherit;
  transition: all 0.12s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-dim); }

.btn-block { width: 100%; justify-content: center; }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.select-sm {
  width: auto;
  padding: 0.3rem 0.45rem;
  font-size: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
}

/* APP LAYOUT */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 180px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1rem 0.85rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.user-name {
  font-size: 0.7rem;
  color: var(--text3);
  display: block;
  margin-top: 0.1rem;
}

.nav-menu {
  list-style: none;
  padding: 0.4rem;
  flex: 1;
}

.nav-menu li {
  margin-bottom: 1px;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.55rem;
  color: var(--text2);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 400;
  border-radius: 4px;
  transition: all 0.1s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg3);
}

.nav-link.active {
  color: var(--text);
  background: var(--bg3);
  font-weight: 500;
}

.sidebar-footer {
  padding: 0.65rem;
  border-top: 1px solid var(--border);
}

/* CONTENT */
.content {
  flex: 1;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  background: var(--bg);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.tab-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tab-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

/* TABLE */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg2);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  font-size: 0.8rem;
}

th {
  color: var(--text3);
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}

td {
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 500;
}

.badge-active { background: var(--success-dim); color: var(--success); }
.badge-completed { background: rgba(255,255,255,0.05); color: var(--text3); }
.badge-cancelled { background: var(--danger-dim); color: var(--danger); }
.badge-error { background: var(--danger-dim); color: var(--danger); }
.badge-paused { background: var(--warning-dim); color: var(--warning); }
.badge-once { background: rgba(255,255,255,0.05); color: var(--text2); }
.badge-daily { background: var(--accent-dim); color: var(--accent); }
.badge-weekly { background: var(--success-dim); color: var(--success); }
.badge-monthly { background: var(--warning-dim); color: var(--warning); }
.badge-workflow { background: var(--accent-dim); color: var(--accent); }

/* View details */
.view-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.view-detail:last-child { border-bottom: none; }
.view-label {
  color: var(--text3);
  font-size: 0.75rem;
  font-weight: 500;
}
.view-section {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.view-prompt {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem;
  margin-top: 0.35rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-word;
}
.wf-info {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text2);
  line-height: 1.6;
}

.actions-cell {
  display: flex;
  gap: 0.1rem;
}

.btn-icon {
  padding: 0.2rem 0.3rem;
  font-size: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.1s;
}

.btn-icon:hover { background: var(--bg3); color: var(--text2); }
.btn-icon.danger:hover { color: var(--danger); background: var(--danger-dim); }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: var(--bg2);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.1rem;
  border-radius: 3px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--bg3);
  color: var(--text2);
}

.modal-body {
  padding: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
}

/* CONFIG */
.config-sections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.config-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.config-section h3 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
  color: var(--text2);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text3);
  font-size: 0.82rem;
}

.empty-state p {
  margin-top: 0.5rem;
}

/* Lucide Icon Sizes */
.icon-lg { width: 28px; height: 28px; stroke-width: 1.5; }
.icon-brand { width: 16px; height: 16px; stroke-width: 2; vertical-align: -2px; }
.icon-nav { width: 15px; height: 15px; stroke-width: 1.8; vertical-align: -3px; margin-right: 0.3rem; }
.icon-title { width: 18px; height: 18px; stroke-width: 1.8; vertical-align: -3px; margin-right: 0.25rem; color: var(--text3); }
.icon-section { width: 14px; height: 14px; stroke-width: 1.8; vertical-align: -2px; margin-right: 0.2rem; }
.icon-label { width: 12px; height: 12px; stroke-width: 1.8; vertical-align: -2px; margin-right: 0.15rem; color: var(--text3); }
.icon-btn { width: 13px; height: 13px; stroke-width: 2; vertical-align: -2px; }
.icon-action { width: 13px; height: 13px; stroke-width: 1.8; }
.icon-row { width: 13px; height: 13px; stroke-width: 1.8; vertical-align: -2px; margin-right: 0.2rem; color: var(--text3); }
.icon-empty { width: 32px; height: 32px; stroke-width: 1.2; }
.td-msg { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login-logo {
  margin-bottom: 0.5rem;
  color: var(--text3);
}

.sidebar-brand {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 0.78rem;
  z-index: 200;
  animation: slideIn 0.2s ease;
}

.toast.success { border-left: 2px solid var(--success); }
.toast.error { border-left: 2px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateY(0.5rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-header { border-bottom: none; padding: 0.5rem 0.65rem; }
  .sidebar-header h2 { font-size: 0.85rem; }
  .user-name { display: none; }
  .nav-menu { display: flex; padding: 0 0.2rem; gap: 1px; }
  .nav-link { padding: 0.35rem 0.5rem; font-size: 0.75rem; }
  .sidebar-footer { padding: 0.4rem; border-top: none; margin-left: auto; }
  .content { padding: 0.85rem; }
  .settings-grid { grid-template-columns: 1fr; }
}
