/* ============================================================
   app.css – Dev Manager Design System
   DM Sans + DM Mono · CSS Custom Properties · PHP 8.2 App
   ============================================================ */

/* ── Custom Properties ────────────────────────────────────── */
:root {
  --bg:           #f4f5f7;
  --surface:      #ffffff;
  --surface-2:    #f9fafb;
  --border:       #e5e7eb;
  --border-light: #f0f1f3;
  --text-1:       #111827;
  --text-2:       #6b7280;
  --text-3:       #9ca3af;
  --accent:       #2563eb;
  --accent-dark:  #1d4ed8;
  --accent-soft:  #eff6ff;
  --green:        #16a34a;
  --green-soft:   #f0fdf4;
  --red:          #dc2626;
  --red-soft:     #fef2f2;
  --amber:        #d97706;
  --amber-soft:   #fffbeb;
  --purple:       #7c3aed;
  --purple-soft:  #f5f3ff;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,.08);
  --radius:       12px;
  --radius-sm:    8px;
}

/* ── Reset + Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; line-height: 1.25; color: var(--text-1); }
h2 { font-size: 22px; font-weight: 600; line-height: 1.3;  color: var(--text-1); }
h3 { font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--text-1); }
h4 { font-size: 15px; font-weight: 600; line-height: 1.4;  color: var(--text-1); }

p { font-size: 14px; color: var(--text-2); line-height: 1.6; }

code, kbd {
  font-family: 'DM Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-1);
}

pre {
  font-family: 'DM Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  line-height: 1.6;
  color: var(--text-1);
}

pre code {
  background: none;
  border: none;
  padding: 0;
}

/* ── Layout ───────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 0;
  z-index: 100;
}

.app-header-left {
  display: flex;
  align-items: center;
  width: 260px;
  padding: 0 20px;
  flex-shrink: 0;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 260px;
  height: calc(100vh - 64px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 90;
}

.app-content {
  margin-left: 260px;
  padding: 32px;
  min-height: calc(100vh - 64px);
}

.main-container {
  max-width: 1280px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 { margin-bottom: 4px; }
.page-header p  { font-size: 14px; }

/* ── Navigation ───────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.nav-menu {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  padding: 12px 8px 6px;
  margin-top: 8px;
}

.nav-section-label:first-child { margin-top: 0; }

.nav-item { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background .12s, color .12s;
  cursor: pointer;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .75;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text-1);
  text-decoration: none;
}

.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-link.active svg { opacity: 1; color: var(--accent); }

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  text-decoration: none;
}

.user-chip:hover {
  background: var(--border-light);
  text-decoration: none;
}

.user-avatar {
  width: 26px;
  height: 26px;
  background: var(--accent-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .08s;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(.98); }

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-1);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
  text-decoration: none;
  color: var(--text-1);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #fca5a5;
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-1);
  text-decoration: none;
}

.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
  gap: 5px;
}
.btn-sm svg { width: 13px; height: 13px; }

.btn-lg {
  font-size: 15px;
  padding: 11px 22px;
}

.btn-icon {
  padding: 8px;
  aspect-ratio: 1;
}
.btn-icon.btn-sm { padding: 5px; }

.btn:disabled,
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.form-label .required {
  color: var(--red);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}

.form-control::placeholder { color: var(--text-3); }

.form-control:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-control:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-control.is-invalid { border-color: var(--red); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.1); }

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  flex: 1;
  border-radius: 0;
}

.input-group-prepend,
.input-group-append {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.input-group-prepend {
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group-append {
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-group .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.input-with-icon {
  position: relative;
}

.input-with-icon .form-control {
  padding-left: 38px;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.input-with-icon .input-icon-right {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 2px;
  display: flex;
  align-items: center;
}
.input-with-icon .input-icon-right:hover { color: var(--text-2); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Badges / Status ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active    { background: var(--green-soft); color: var(--green);  border-color: #bbf7d0; }
.badge-inactive  { background: var(--surface-2);  color: var(--text-3); border-color: var(--border); }
.badge-success   { background: var(--green-soft); color: var(--green);  border-color: #bbf7d0; }
.badge-error     { background: var(--red-soft);   color: var(--red);    border-color: #fca5a5; }
.badge-warning   { background: var(--amber-soft); color: var(--amber);  border-color: #fde68a; }
.badge-info      { background: var(--accent-soft);color: var(--accent); border-color: #bfdbfe; }
.badge-pending   { background: var(--amber-soft); color: var(--amber);  border-color: #fde68a; }
.badge-paused    { background: var(--surface-2);  color: var(--text-2); border-color: var(--border); }
.badge-cancelled { background: var(--red-soft);   color: var(--red);    border-color: #fca5a5; }
.badge-waiting   { background: var(--purple-soft);color: var(--purple); border-color: #ddd6fe; }

.badge-running {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #bfdbfe;
}

.badge-running .badge-dot {
  background: var(--accent);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 14px;
}

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background .1s;
}

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

tbody tr:hover { background: var(--surface-2); }

tbody td {
  padding: 12px 16px;
  color: var(--text-1);
  vertical-align: middle;
}

td.muted { color: var(--text-3); font-size: 13px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-success {
  background: var(--green-soft);
  border-color: #bbf7d0;
  color: #14532d;
}

.alert-error {
  background: var(--red-soft);
  border-color: #fca5a5;
  color: #7f1d1d;
}

.alert-info {
  background: var(--accent-soft);
  border-color: #bfdbfe;
  color: #1e3a5f;
}

.alert-warning {
  background: var(--amber-soft);
  border-color: #fde68a;
  color: #78350f;
}

/* ── Stats Grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon-blue   { background: var(--accent-soft); color: var(--accent); }
.stat-icon-green  { background: var(--green-soft);  color: var(--green); }
.stat-icon-red    { background: var(--red-soft);    color: var(--red); }
.stat-icon-amber  { background: var(--amber-soft);  color: var(--amber); }
.stat-icon-purple { background: var(--purple-soft); color: var(--purple); }

.stat-content { flex: 1; min-width: 0; }

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

.stat-meta.positive { color: var(--green); }
.stat-meta.negative { color: var(--red); }

/* ── Kanban Board ─────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  flex: 0 0 280px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-column-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.kanban-column-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--border-light);
  border-radius: 10px;
  padding: 2px 8px;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: grab;
  transition: box-shadow .12s, transform .12s;
  box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card:active { cursor: grabbing; }

.kanban-card.dragging {
  opacity: .5;
  transform: scale(.98);
  box-shadow: none;
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
  line-height: 1.35;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kanban-cards.drag-over {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
}

/* ── Execution Monitor / Timeline ─────────────────────────── */
.execution-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

.step-item {
  display: flex;
  gap: 14px;
  position: relative;
}

.step-connector-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 28px;
}

.step-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.step-status-icon svg { width: 14px; height: 14px; }

.step-status-icon.success  { background: var(--green-soft);  color: var(--green); }
.step-status-icon.error    { background: var(--red-soft);    color: var(--red); }
.step-status-icon.running  { background: var(--accent-soft); color: var(--accent); }
.step-status-icon.pending  { background: var(--surface-2);   color: var(--text-3); border: 1.5px solid var(--border); }
.step-status-icon.waiting  { background: var(--purple-soft); color: var(--purple); }

.step-status-icon.running {
  animation: pulse-ring 1.6s ease-in-out infinite;
}

.step-connector {
  flex: 1;
  width: 2px;
  background: var(--border);
  min-height: 20px;
  margin: 2px 0;
}

.step-content {
  flex: 1;
  padding: 2px 0 20px;
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 2px;
}

.step-description {
  font-size: 13px;
  color: var(--text-2);
}

.step-time {
  font-size: 12px;
  color: var(--text-3);
  font-family: 'DM Mono', monospace;
  margin-top: 4px;
}

.step-item:last-child .step-connector { display: none; }

/* ── Agent Console ────────────────────────────────────────── */
.console-wrap {
  display: flex;
  flex-direction: column;
  height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.console-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-bubble {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.message-bubble.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message-bubble.agent {
  align-self: flex-start;
  align-items: flex-start;
}

.message-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.message-bubble.user .message-content {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-bubble.agent .message-content {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-bottom-left-radius: 4px;
}

.message-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  padding: 0 4px;
}

.console-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: var(--surface-2);
}

.console-input-area .form-control {
  flex: 1;
}

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn .15s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: slideIn .18s ease;
}

.modal-sm { max-width: 380px; }
.modal-lg { max-width: 720px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .12s, background .12s;
}
.modal-close:hover { color: var(--text-1); background: var(--surface-2); }
.modal-close svg   { width: 18px; height: 18px; }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .1s, border-color .1s, color .1s;
}

.page-btn:hover    { background: var(--surface-2); color: var(--text-1); text-decoration: none; }
.page-btn.active   { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: .4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

.empty-state p { font-size: 14px; }

/* ── Skeleton Loader ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-75 { width: 75%; }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-3);
  font-size: 13px;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-1);
  color: #fff;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Utilities ────────────────────────────────────────────── */
.d-flex         { display: flex; }
.d-inline-flex  { display: inline-flex; }
.align-center   { align-items: center; }
.align-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.flex-1         { flex: 1; }
.flex-wrap      { flex-wrap: wrap; }

.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.mr-4  { margin-right: 4px; }
.mr-8  { margin-right: 8px; }
.ml-auto { margin-left: auto; }

.p-0  { padding: 0 !important; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }
.text-muted   { color: var(--text-3) !important; }
.text-small   { font-size: 12px; }
.text-accent  { color: var(--accent); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-warning { color: var(--amber); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}

.w-full  { width: 100%; }
.h-full  { height: 100%; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(.85); }
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.35); }
  70%  { box-shadow: 0 0 0 8px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.spin     { animation: spin 1s linear infinite; }
.fade-in  { animation: fadeIn .2s ease; }
.slide-in { animation: slideIn .2s ease; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 200;
  }

  .app-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .app-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .app-header-left { width: auto; }

  .kanban-board { gap: 10px; }
  .kanban-column { flex: 0 0 240px; }

  .modal { max-width: calc(100vw - 32px); }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .app-content { padding: 16px 12px; }
  .btn-lg { font-size: 14px; padding: 10px 18px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
}
