:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #667067;
  --line: #dce2dc;
  --accent: #176b5b;
  --accent-strong: #0f4f43;
  --amber: #c47a16;
  --red: #b94646;
  --blue: #2d5f9a;
  --shadow: 0 14px 36px rgba(34, 48, 40, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 107, 91, .05) 1px, transparent 1px),
    linear-gradient(rgba(23, 107, 91, .05) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.locked .topbar,
.locked .shell,
.locked dialog {
  display: none;
}

.lock-screen {
  display: none;
  min-height: 100vh;
  padding: 18px;
  place-items: center;
}

.locked .lock-screen {
  display: grid;
}

.lock-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lock-card h1 {
  font-size: 30px;
}

.lock-error {
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px clamp(16px, 4vw, 34px);
  background: rgba(244, 246, 243, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.sync-status[data-status="En ligne"] {
  color: var(--accent);
}

.sync-status[data-status="Hors ligne"] {
  color: var(--red);
}

.notify-btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.notify-btn span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  color: white;
  background: var(--red);
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1;
}

h2 {
  font-size: 16px;
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 34px) 34px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel,
.toolbar,
.stats article,
.task,
.order-item,
.timeline-item {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(34, 48, 40, .06);
}

.panel {
  border-radius: 8px;
  padding: 14px;
}

.panel-head,
.dialog-head,
.task-head,
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.stack,
.tree {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.building-row,
.tree-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.building-btn,
.tree-btn {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: #f8faf8;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
}

.tree-actions {
  display: flex;
  gap: 5px;
}

.mini-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #ffffff;
  font-weight: 850;
}

.mini-btn:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.building-btn.active,
.tree-btn.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.tree-node[data-depth="1"] {
  margin-left: 14px;
}

.tree-node[data-depth="2"] {
  margin-left: 28px;
}

.tree-node[data-depth="3"] {
  margin-left: 42px;
}

.workspace {
  min-width: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stats article {
  border-radius: 8px;
  padding: 16px;
}

.stats span {
  display: block;
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.stats p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 220px 170px;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, .12);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  overflow-x: auto;
}

.tab,
.ghost,
.primary,
.icon-btn {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid var(--line);
  font-weight: 800;
}

.tab {
  padding: 0 16px;
  background: #ffffff;
  color: var(--muted);
}

.tab.active {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.primary {
  padding: 0 16px;
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.primary:hover {
  background: var(--accent-strong);
}

.ghost {
  padding: 0 14px;
  background: white;
  color: var(--ink);
}

.danger {
  color: var(--red);
}

.icon-btn {
  width: 40px;
  flex: 0 0 40px;
  background: white;
  color: var(--ink);
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(230px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.column {
  min-height: 420px;
  background: rgba(255, 255, 255, .52);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #eef2ee;
  color: var(--ink);
}

.task-list {
  display: grid;
  gap: 9px;
}

.task {
  border-radius: 8px;
  padding: 11px;
}

.task h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.task p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.task-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 9px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.task-link:hover {
  text-decoration: underline;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #384139;
  background: #eef2ee;
  font-size: 12px;
  font-weight: 750;
}

.badge.high {
  color: #7a2d2d;
  background: #fae5e3;
}

.badge.order {
  color: #774808;
  background: #faead1;
}

.badge.done {
  color: #155447;
  background: #dff3ed;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.card-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--muted);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.notification-panel,
.timeline,
.orders,
.reminders,
.archive {
  display: grid;
  gap: 10px;
}

.notification-panel {
  margin-bottom: 14px;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fff9ef;
  border: 1px solid #efd8ad;
  border-radius: 8px;
}

.notification-item h3 {
  margin: 0;
  font-size: 15px;
}

.notification-item p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.notification-actions {
  display: flex;
  gap: 8px;
}

.timeline-item,
.order-item,
.reminder-item {
  border-radius: 8px;
  padding: 14px;
}

.view-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.reminder-list,
.archive-list {
  display: grid;
  gap: 10px;
}

.reminder-item,
.archive-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(34, 48, 40, .06);
}

.reminder-item.is-done {
  opacity: .72;
}

.reminder-item p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.archive-item p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.reminder-actions {
  display: flex;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
}

.date-block {
  color: var(--accent);
  font-weight: 850;
}

.empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
}

dialog {
  width: min(680px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(23, 32, 27, .38);
  backdrop-filter: blur(3px);
}

.dialog-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
}

@media (max-width: 1000px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board {
    grid-template-columns: repeat(6, 260px);
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar .primary {
    min-width: 88px;
  }

  .shell {
    padding-inline: 12px;
  }

  .sidebar,
  .stats,
  .toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .reminder-item,
  .archive-item {
    grid-template-columns: 1fr;
  }

  .reminder-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .notification-item {
    grid-template-columns: 1fr;
  }

  .notification-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions span {
    display: none;
  }
}
