/* Atelier PWA — Mobile-first 375px, Holo-Glass, sombre */

:root {
  --bg:        #0d0d0d;
  --surface:   #161616;
  --surface2:  #1f1f1f;
  --border:    rgba(255,255,255,0.08);
  --border-hi: rgba(255,255,255,0.16);
  --text:      #f0f0f0;
  --text-mute: #888;
  --accent:    #4a9eff;
  --accent-dim:rgba(74,158,255,0.15);
  --danger:    #e05252;
  --radius:    10px;
  --radius-sm: 6px;
  --header-h: 52px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  padding: 0;
}

input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); }

/* ── HEADER ──────────────────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  z-index: 100;
}
.header-back {
  font-size: 20px;
  color: var(--accent);
  padding: 6px;
  margin: -6px;
  min-width: 32px;
  text-align: center;
}
.header-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-dot {
  font-size: 14px;
  min-width: 28px;
  text-align: center;
  line-height: 1;
}
.sync-dot.synced   { color: #4caf84; }
.sync-dot.pending  { color: #e0a050; }
.sync-dot.offline  { color: var(--danger); }

/* ── VIEWS ───────────────────────────────────────────────────────────────── */
.view { display: none; padding-top: var(--header-h); }
.view.active { display: block; }

/* ── HOME ────────────────────────────────────────────────────────────────── */
#view-home .header-title { font-size: 18px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}

.project-card {
  aspect-ratio: 1.4;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background: var(--card-color, var(--accent));
}
.project-card:active { transform: scale(0.97); }
.project-card-color {
  position: absolute;
  top: 10px; right: 10px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--card-color, var(--accent));
}
.project-card-name {
  font-size: 14px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.home-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ── FAB ─────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 24px; right: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(74,158,255,0.35);
  z-index: 90;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s;
}
.fab:active { transform: scale(0.93); }
.fab-icon { line-height: 1; }

/* ── KANBAN VIEW ─────────────────────────────────────────────────────────── */
#view-kanban {
  height: 100dvh;
  display: none;
  flex-direction: column;
}
#view-kanban.active { display: flex; }

.kanban-board {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 12px;
  padding: 14px 14px 24px;
  align-items: flex-start;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

/* ── COLUMN ──────────────────────────────────────────────────────────────── */
.kanban-col {
  flex: 0 0 270px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--header-h) - 38px);
  scroll-snap-align: start;
}

.col-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.col-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  cursor: text;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.12s;
}
.col-title:focus {
  outline: none;
  border-color: var(--accent);
  color: var(--text);
}
.col-menu-btn {
  color: var(--text-mute);
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
}
.col-menu-btn:active { background: var(--surface2); }

.col-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 40px;
}
.col-cards.sortable-ghost-visible { background: var(--accent-dim); border-radius: 6px; }

.col-add-btn {
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  transition: color 0.12s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.col-add-btn:active { color: var(--text); }

/* ── ADD COLUMN ──────────────────────────────────────────────────────────── */
.add-col-btn {
  flex: 0 0 200px;
  height: 52px;
  align-self: flex-start;
  background: var(--surface);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-mute);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}
.add-col-btn:active { color: var(--text); border-color: var(--accent); }

/* ── CARD ────────────────────────────────────────────────────────────────── */
.kanban-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.kanban-card:active { border-color: var(--border-hi); transform: scale(0.99); }
.kanban-card.sortable-ghost {
  opacity: 0.35;
}
.kanban-card.sortable-drag {
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border-color: var(--accent);
  opacity: 1 !important;
}
.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}
.card-note {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── MODALS ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 500px;
  padding: 20px 18px 32px;
  transform: translateY(20px);
  transition: transform 0.18s;
}
.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.modal-row { margin-bottom: 12px; }
.modal-label {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 5px;
  display: block;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: 0.75; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  flex: 1;
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text-mute);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

/* ── COLOR SWATCHES ──────────────────────────────────────────────────────── */
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.swatch.selected { border-color: #fff; transform: scale(1.15); }

/* ── COL CONTEXT MENU ────────────────────────────────────────────────────── */
.ctx-menu {
  position: absolute;
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  min-width: 150px;
  z-index: 300;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ctx-menu-item {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  text-align: left;
  transition: background 0.1s;
}
.ctx-menu-item:active { background: var(--surface); }
.ctx-menu-item.danger { color: var(--danger); }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-mute);
  font-size: 14px;
  text-align: center;
  gap: 8px;
}
.empty-state-icon { font-size: 32px; opacity: 0.4; }

/* ── SCROLLBAR ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }
