/* aTaskManager — dark theme only. */

:root {
  --bg: #0e0f13;
  --bg-elev: #171922;
  --bg-card: #1d2030;
  --bg-card-hover: #242838;
  --border: #2a2e3f;
  --text: #e6e8ef;
  --muted: #9aa0b4;
  --accent: #6c8cff;
  --accent-2: #4a6bff;
  --danger: #ff6b6b;
  --special: #f5bd23;
  --radius: 10px;
  --gap: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { background: var(--bg-card-hover); }
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
button.primary:hover { background: var(--accent); }
button.danger { color: var(--danger); }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.muted { color: var(--muted); }
.error { color: var(--danger); }

/* --- header / nav --- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 10px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.2px; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
}
nav a:hover { background: var(--bg-card); color: var(--text); }
nav a.active { background: var(--bg-card); color: var(--text); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.online { background: #3ad29f; }
.dot.offline { background: #f5bd23; }

#screen { padding: 16px; max-width: 1600px; margin: 0 auto; }

/* --- login --- */
.login {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.login h1 { margin: 0; }

/* --- board --- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  align-items: start;
}
.column {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.column h2 { margin: 2px 4px 4px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 0; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  cursor: grab;
}
.card:hover { background: var(--bg-card-hover); }
.card.special { border-left: 3px solid var(--special); box-shadow: inset 0 0 0 1px rgba(245, 189, 35, 0.25); }
.card.generated { border-left: 3px solid var(--accent); }
.card .name { flex: 1; outline: none; word-break: break-word; }
.card .name:focus { background: var(--bg-elev); border-radius: 6px; padding: 0 4px; }
.card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.card-actions button { padding: 2px 7px; line-height: 1.2; }
.card-actions .done { color: #3ad29f; }
.drag-ghost { opacity: 0.4; }

.add { margin-top: 8px; background: transparent; border: 1px dashed var(--border); }
.add:focus { border-style: solid; }
/* No gap above the add-box when the column has no cards. */
.cards:empty + .add { margin-top: 0; }

/* --- panels (schedule/settings) --- */
.card-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  max-width: 640px;
}
.card-panel h2 { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { color: var(--muted); font-size: 13px; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox input { width: auto; }
.form-actions { display: flex; gap: 8px; }

.sched-list { display: flex; flex-direction: column; gap: 8px; }
.sched-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.sched-item.special { border-left: 3px solid var(--special); }
.sched-meta { display: flex; flex-direction: column; gap: 2px; }
.sched-actions { display: flex; gap: 6px; }

/* --- history --- */
.history-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
table.history th, table.history td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.history th { color: var(--muted); position: sticky; top: 0; background: var(--bg-elev); }
table.history td:last-child { white-space: normal; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }

/* --- responsive: horizontal-scroll columns on narrow screens --- */
@media (max-width: 760px) {
  #screen { padding: 12px; }
  .board {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .column { flex: 0 0 84%; scroll-snap-align: start; }
}
