@font-face {
  font-family: 'Estedad';
  src: url('../fonts/estedad-fd-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --custom-bg: #faf3e0;
  --canvas: var(--custom-bg);
  --surface: #fffdf8;
  --surface-2: #f7f1e7;
  --sidebar: #005f73;
  --sidebar-ink: #f6fbfc;
  --sidebar-muted: #b8d6dc;
  --sidebar-line: rgba(255,255,255,.16);
  --ink: #17252a;
  --muted: #66777c;
  --line: #e5d9c7;
  --blue: #005f73;
  --orange: #d8571f;
  --accent-soft: #fbe2d5;
  --accent-ink: #8e3411;
  --danger: #dc2626;
  --danger-soft: #fee7e7;
  --success: #15803d;
  --success-soft: #dcfce7;
  --ring-track: #e6dac8;
  --shadow: 0 1px 2px rgba(32,37,40,.04), 0 12px 34px rgba(35,42,46,.07);
  --radius: 18px;
}

[data-theme="dark"] {
  --canvas: #0e171b;
  --surface: #162329;
  --surface-2: #1c2c33;
  --sidebar: #081318;
  --sidebar-ink: #f2f8f9;
  --sidebar-muted: #91abb2;
  --sidebar-line: #20343c;
  --ink: #e8f0f2;
  --muted: #9db0b6;
  --line: #2a3d44;
  --accent-soft: #4b281b;
  --accent-ink: #ffb28d;
  --danger-soft: #3c1c20;
  --success-soft: #123522;
  --ring-track: #2b3d44;
  --shadow: 0 12px 34px rgba(0,0,0,.28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
html { background: var(--canvas); }
body {
  margin: 0;
  font-family: 'Estedad', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
a { color: inherit; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(216,87,31,.16);
}

.app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 300px;
  flex: 0 0 300px;
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 18px 15px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--orange); color: #fff;
  font-size: 19px; font-weight: 900;
}
.brand h1 { margin: 0; font-size: 16px; }
.brand span { display: block; font-size: 11.5px; color: var(--sidebar-muted); }
.main-nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  text-align: right;
  padding: 10px 12px;
  border-radius: 11px;
  background: transparent;
  color: var(--sidebar-ink);
  font-weight: 700;
}
.nav-item span { width: 22px; text-align: center; font-size: 17px; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.12); }
.overall {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--sidebar-line);
  border-radius: 15px;
  padding: 13px;
}
.k { font-size: 12px; color: var(--muted); }
.sidebar .k { color: var(--sidebar-muted); }
.v { font-weight: 850; }
.proj-head { display: flex; justify-content: space-between; align-items: center; }
.proj-head .t { color: var(--sidebar-muted); font-size: 12px; font-weight: 800; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.1); color: #fff;
  font-size: 21px;
}
.proj-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.proj-list::-webkit-scrollbar { width: 5px; }
.proj-list::-webkit-scrollbar-thumb { background: var(--sidebar-line); border-radius: 9px; }
.proj-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  background: transparent; color: var(--sidebar-ink); text-align: right;
}
.proj-item:hover, .proj-item.active { background: rgba(255,255,255,.1); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pct { font-size: 12px; font-weight: 800; color: var(--sidebar-muted); }
.sidebar-empty { color: var(--sidebar-muted); text-align: center; font-size: 13px; padding: 12px; }
.side-foot { border-top: 1px solid var(--sidebar-line); padding-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.foot-btn {
  display: block; text-decoration: none; text-align: center;
  background: rgba(255,255,255,.08); color: var(--sidebar-ink);
  border-radius: 9px; padding: 8px; font-size: 12.5px;
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 30;
  align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 15px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.menu { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); }
.tt { font-weight: 850; }
.content { max-width: 1120px; margin: 0 auto; padding: 28px 30px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 27px; }
.page-head p { margin: 3px 0 0; color: var(--muted); }
.btn-primary, .btn-save, .btn-link-primary {
  background: var(--orange); color: #fff;
  border-radius: 12px; padding: 10px 17px; font-weight: 850;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn-secondary {
  background: var(--surface); color: var(--blue);
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 14px; font-weight: 800;
}
.btn-ghost { background: var(--surface-2); color: var(--muted); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(290px,.8fr); gap: 16px; margin-bottom: 16px; }
.widget {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 17px;
}
.widget + .widget { margin-top: 16px; }
.dashboard-grid .widget { margin-top: 0; }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.widget-head h3 { margin: 0; font-size: 16px; }
.widget-head span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.latest-list { display: grid; gap: 8px; }
.latest-item {
  display: grid; grid-template-columns: 30px minmax(0,1fr) auto;
  align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface-2);
}
.latest-item.completed { opacity: .78; }
.latest-main { min-width: 0; cursor: pointer; }
.latest-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.latest-meta { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-check, .chk, .mini-check {
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--surface); color: transparent;
  display: grid; place-items: center; font-weight: 900;
}
.dash-check.on, .chk.on, .mini-check.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.percent-stepper { display: flex; align-items: center; gap: 5px; }
.percent-stepper button { width: 28px; height: 28px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.percent-stepper span { min-width: 40px; text-align: center; font-weight: 850; color: var(--orange); font-size: 12px; }
.note-pad { min-height: 270px; border: 0; background: transparent; box-shadow: none !important; padding: 0; line-height: 1.9; }
.project-overview-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; }
.project-overview-card {
  text-align: right; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px;
}
.project-overview-top { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 8px; }
.project-overview-top strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.project-overview-top b { color: var(--orange); }
.project-overview-card .bar { margin-top: 10px; }
.project-overview-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 8px; }
.inactive-list { display: grid; gap: 8px; }
.inactive-item { width: 100%; display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 9px; text-align: right; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.inactive-name { font-weight: 800; }
.inactive-time { color: var(--muted); font-size: 12px; }
.widget-empty { color: var(--muted); text-align: center; padding: 24px 12px; }
.success-empty { color: var(--success); background: var(--success-soft); border-radius: 12px; }

.proj-banner { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.project-ring { width: 66px; height: 66px; }
.proj-banner .info { flex: 1; min-width: 0; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-row h2 { margin: 0; font-size: 26px; }
.pdot { width: 12px; height: 12px; border-radius: 50%; }
.note { color: var(--muted); margin-top: 5px; white-space: pre-wrap; }
.proj-actions, .task-tools { display: flex; gap: 5px; }
.pa-btn, .t-tool, .move-btn, .rm {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.pa-btn:hover, .t-tool:hover, .move-btn:hover, .rm:hover { color: var(--blue); border-color: var(--blue); }
.del:hover, .delete-quiet:hover { color: var(--danger) !important; border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 11px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 13px 15px; }
.stat .v { font-size: 22px; }
.add-task, .daily-add, .add-ins, .inline-add { display: flex; gap: 8px; }
.add-task { margin-bottom: 16px; }
.add-task input, .daily-add input, .add-ins input, .inline-add input { flex: 1; }
.tasks { display: grid; gap: 11px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); overflow: hidden; }
.task-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; }
.caret { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); font-size: 20px; transition: transform .2s; }
.task.open .caret { transform: rotate(-90deg); }
.task-main { flex: 1; min-width: 0; }
.task-title { display: flex; align-items: center; gap: 7px; font-weight: 800; flex-wrap: wrap; }
.prio { width: 8px; height: 8px; border-radius: 50%; }
.badge { font-size: 10.5px; border-radius: 20px; padding: 2px 8px; }
.badge.todo { background: var(--surface-2); color: var(--muted); }
.badge.doing { background: var(--accent-soft); color: var(--accent-ink); }
.badge.done { background: var(--orange); color: #fff; }
.bar-wrap { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.bar { height: 7px; border-radius: 20px; background: var(--ring-track); overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; background: var(--orange); border-radius: inherit; }
.task-pct, .ipct { color: var(--orange); font-weight: 850; min-width: 40px; text-align: left; font-size: 12.5px; }
.task-body { display: none; background: var(--surface-2); border-top: 1px solid var(--line); padding: 13px 14px 15px; }
.task.open .task-body { display: block; }
.ins-label { color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 6px; }
.instruction-card { border-bottom: 1px solid var(--line); }
.instruction-card:last-of-type { border-bottom: 0; }
.ins { display: grid; grid-template-columns: 28px minmax(0,1fr) auto 34px 34px 34px 34px; align-items: center; gap: 7px; padding: 9px 0; }
.instruction-card.completed .ins-title { text-decoration: line-through; color: var(--muted); }
.ins-text { min-width: 0; }
.ins-title { font-weight: 800; overflow-wrap: anywhere; }
.details-link, .text-button { background: transparent; color: var(--blue); padding: 0; font-size: 11.5px; font-weight: 750; }
.slider-wrap { display: flex; align-items: center; gap: 6px; }
.slider-wrap input { width: 92px; padding: 0; border: 0; box-shadow: none !important; }
.done-label { color: #fff; background: var(--orange); padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 850; white-space: nowrap; }
.instruction-details { margin: 0 35px 10px 0; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 11px 12px; }
.detail-block + .detail-block { border-top: 1px solid var(--line); margin-top: 9px; padding-top: 9px; }
.detail-block strong { font-size: 12px; }
.detail-block p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; }
.inline-steps { display: grid; gap: 6px; margin-top: 7px; }
.inline-step { display: flex; align-items: center; gap: 8px; text-align: right; background: var(--surface-2); border-radius: 9px; padding: 7px 9px; }
.inline-step span { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: transparent; }
.inline-step.done { color: var(--muted); text-decoration: line-through; }
.inline-step.done span { background: var(--orange); border-color: var(--orange); color: #fff; }
.add-ins { margin-top: 12px; }
.add-ins button, .inline-add button { border: 1px solid var(--line); background: var(--surface); color: var(--orange); font-weight: 800; border-radius: 10px; padding: 0 13px; }
.manual-wrap { display: flex; align-items: center; gap: 10px; }
.manual-wrap input { flex: 1; padding: 0; border: 0; box-shadow: none !important; }
.hint, .muted-small { color: var(--muted); font-size: 12px; }

.daily-widget { max-width: 780px; }
.daily-list { display: grid; gap: 8px; margin-top: 14px; }
.daily-item { display: grid; grid-template-columns: 30px minmax(0,1fr) 34px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; background: var(--surface-2); }
.daily-item.completed span { text-decoration: line-through; color: var(--muted); }
.delete-quiet { width: 32px; height: 32px; border-radius: 8px; background: transparent; color: var(--muted); }
.completed-divider { position: relative; text-align: center; margin: 10px 0 2px; color: var(--muted); font-size: 11.5px; }
.completed-divider::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.completed-divider span { position: relative; background: var(--surface); padding: 0 10px; }

.overlay { position: fixed; inset: 0; display: none; place-items: center; z-index: 100; background: rgba(5,17,22,.5); backdrop-filter: blur(3px); padding: 18px; }
.overlay.show { display: grid; }
.modal { width: 100%; max-width: 440px; max-height: calc(100dvh - 36px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 28px 80px rgba(0,0,0,.35); padding: 21px; }
.modal-wide { max-width: 620px; }
.modal h3 { margin: 0 0 13px; }
.modal h4 { margin: 0; }
.modal label { display: block; color: var(--muted); font-size: 12.5px; font-weight: 800; margin: 11px 0 5px; }
.modal-subtitle { margin: -7px 0 10px; color: var(--muted); }
.modal-foot { display: flex; gap: 9px; margin-top: 18px; }
.modal-foot button { flex: 1; padding: 10px 12px; border-radius: 11px; font-weight: 850; }
.modal-divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.color-input { height: 48px; padding: 4px; }
.swatches, .prio-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 9px; border: 3px solid transparent; }
.swatch.sel { border-color: var(--ink); transform: scale(1.07); }
.prio-opt { flex: 1; min-width: 90px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px; font-weight: 800; }
.prio-opt span { width: 8px; height: 8px; border-radius: 50%; }
.prio-opt.sel { border-color: var(--orange); background: var(--accent-soft); }
.range-label { color: var(--orange); font-weight: 850; text-align: left; }
.step-editor { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.step-edit-row { display: grid; grid-template-columns: 26px minmax(0,1fr) 30px 30px 30px; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 7px; margin-bottom: 6px; }
.step-edit-row.completed span { color: var(--muted); text-decoration: line-through; }
.step-edit-row > button:not(.mini-check) { width: 30px; height: 30px; border-radius: 7px; background: var(--surface); color: var(--muted); }
.inline-add { margin-top: 9px; }

.ring { position: relative; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.rtxt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.empty h3 { color: var(--ink); }
.compact-empty { padding: 32px 20px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 200; transform: translate(-50%,18px); opacity: 0; pointer-events: none; background: var(--blue); color: #fff; border-radius: 11px; padding: 10px 16px; transition: .2s; box-shadow: 0 14px 35px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.scrim { display: none; }

.auth-body { min-height: 100dvh; display: grid; place-items: center; padding: 18px; overflow: auto; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 14px; font-size: 22px; }
.auth-card label { display: block; margin: 11px 0 5px; color: var(--muted); font-weight: 800; font-size: 13px; }
.btn-primary.full { width: 100%; margin-top: 15px; }
.alert { border-radius: 11px; padding: 10px 12px; margin: 10px 0; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--success-soft); color: var(--success); }
.alert.warn { background: #fff2c6; color: #8a5a00; }
.update-card p { color: var(--muted); }

@media (max-width: 980px) {
  .project-overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; right: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(100%); transition: transform .22s; box-shadow: -14px 0 45px rgba(0,0,0,.25); width: min(86vw,320px); }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.42); }
  .topbar { display: flex; }
  .content { padding: 20px 15px 56px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .note-pad { min-height: 190px; }
  .ins { grid-template-columns: 28px minmax(0,1fr) 34px 34px; }
  .ins .slider-wrap, .ins .done-label { grid-column: 2; justify-self: start; }
  .ins .rm, .ins .move-btn { grid-row: 2; }
  .instruction-details { margin-right: 0; }
  .task-head { flex-wrap: wrap; }
  .task-tools { margin-right: 40px; }
  .page-head { align-items: flex-start; }
}

@media (max-width: 620px) {
  /* 16px prevents automatic focus zoom on iOS Safari and Android browsers. */
  input, textarea, select { font-size: 16px; }
  .page-head { flex-direction: column; }
  .page-head h2, .title-row h2 { font-size: 22px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat:last-child { grid-column: 1 / -1; }
  .project-overview-grid { grid-template-columns: 1fr; }
  .inactive-item { grid-template-columns: 10px minmax(0,1fr); }
  .inactive-time { grid-column: 2; }
  .latest-item { grid-template-columns: 30px minmax(0,1fr); }
  .latest-item .percent-stepper, .latest-item .done-label { grid-column: 2; justify-self: start; }
  .add-task, .daily-add { flex-direction: column; }
  .btn-primary { min-height: 44px; }
  .add-ins { display: grid; grid-template-columns: 1fr 1fr; }
  .add-ins input { grid-column: 1 / -1; }
  .modal { padding: 18px; }
  .modal-foot { position: sticky; bottom: -18px; background: var(--surface); padding: 10px 0 0; }
  .pa-btn, .t-tool, .move-btn, .rm, .dash-check, .chk, .mini-check { min-width: 40px; min-height: 40px; }
  .ins { grid-template-columns: 40px minmax(0,1fr) 40px 40px; gap: 6px; }
  .ins .slider-wrap, .ins .done-label { grid-column: 2 / -1; }
  .task-tools { width: 100%; justify-content: flex-end; margin-right: 0; }
}

/* ---------- scheduled daily todos + SMS settings ---------- */
.form-grid { display: grid; gap: 12px; }
.form-grid.two-col { grid-template-columns: repeat(2,minmax(0,1fr)); }
.switch-row {
  display: flex !important; align-items: center; gap: 9px;
  margin-top: 13px !important; color: var(--ink) !important; cursor: pointer;
}
.switch-row input, .inline-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange); }
.inline-check {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); white-space: nowrap; cursor: pointer;
}
.daily-widget { max-width: 980px; }
.scheduled-add {
  display: grid; grid-template-columns: minmax(220px,1.7fr) minmax(145px,.8fr) minmax(125px,.65fr) auto auto;
  gap: 9px; align-items: center;
}
.scheduled-add .btn-primary { min-height: 44px; }
.daily-help { color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; gap: 7px; flex-wrap: wrap; }
.daily-item {
  grid-template-columns: 32px minmax(0,1fr) 36px 36px;
  align-items: center; min-height: 62px;
}
.daily-main { min-width: 0; }
.daily-title { font-weight: 800; overflow-wrap: anywhere; }
.daily-item.completed .daily-title { text-decoration: line-through; color: var(--muted); }
.daily-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.todo-badge { display: inline-flex; align-items: center; border-radius: 20px; padding: 2px 8px; font-size: 10.5px; font-weight: 750; }
.todo-badge.due { background: var(--surface); color: var(--blue); border: 1px solid var(--line); }
.todo-badge.sms { background: var(--accent-soft); color: var(--accent-ink); }
.todo-badge.danger { background: var(--danger-soft); color: var(--danger); }
.todo-badge.muted { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.edit-quiet, .delete-quiet {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px; background: transparent; color: var(--muted);
}
.edit-quiet:hover { color: var(--blue); background: var(--surface); }
.delete-quiet:hover { color: var(--danger); background: var(--danger-soft); }

.modal-settings { max-width: 820px; }
.settings-title-row, .sms-panel-head, .sms-log-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.settings-title-row h3, .sms-panel-head h4, .sms-log-head h4 { margin: 0; }
.sms-panel-head p, .sms-log-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 22px; }
.settings-tabs {
  display: flex; gap: 5px; margin: 13px 0 16px; padding: 4px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.settings-tab { flex: 1; border-radius: 9px; padding: 8px 12px; background: transparent; color: var(--muted); font-weight: 850; }
.settings-tab.active { background: var(--surface); color: var(--blue); box-shadow: 0 2px 9px rgba(0,0,0,.06); }
.settings-panel[hidden] { display: none !important; }
.compact-switch { margin: 0 !important; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 11px; }
.field-hint { color: var(--muted); font-size: 11.5px; margin-top: 5px; }
.connection-status { border-radius: 12px; padding: 10px 12px; margin-top: 14px; border: 1px solid var(--line); font-size: 12.5px; }
.connection-status.neutral { background: var(--surface-2); color: var(--muted); }
.connection-status.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.connection-status.bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.sms-actions { display: flex; gap: 9px; margin-top: 11px; }
.sms-actions button { flex: 1; min-height: 44px; }
.sms-log-tools { display: flex; gap: 7px; align-items: center; }
.sms-log-tools select { width: 150px; padding: 8px 10px; }
.sms-log-tools button { white-space: nowrap; }
.sms-logs { display: grid; gap: 9px; margin-top: 12px; max-height: 430px; overflow: auto; padding-left: 2px; }
.sms-log-row {
  display: grid; grid-template-columns: minmax(150px,1fr) minmax(190px,1fr) auto;
  align-items: center; gap: 10px; padding: 11px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2);
}
.sms-log-main { min-width: 0; }
.sms-log-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-log-main span, .sms-log-times span { display: block; color: var(--muted); font-size: 11px; }
.log-status { display: inline-flex; justify-content: center; border-radius: 20px; padding: 4px 9px; font-size: 10.5px; font-weight: 850; white-space: nowrap; }
.log-status.sent { background: var(--success-soft); color: var(--success); }
.log-status.failed { background: var(--danger-soft); color: var(--danger); }
.log-status.pending, .log-status.processing { background: #fff2c6; color: #8a5a00; }
.log-status.cancelled { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.sms-log-row details { grid-column: 1 / -1; }
.sms-log-row summary { cursor: pointer; color: var(--blue); font-size: 11.5px; font-weight: 800; }
.log-detail-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; }
.log-detail-grid p { grid-column: 1 / -1; margin: 0; white-space: pre-wrap; }
.error-text { color: var(--danger); }

@media (max-width: 900px) {
  .scheduled-add { grid-template-columns: 1fr 1fr; }
  .scheduled-add .daily-title-input { grid-column: 1 / -1; }
  .scheduled-add .btn-primary { grid-column: 2; }
  .sms-log-row { grid-template-columns: minmax(0,1fr) auto; }
  .sms-log-times { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .form-grid.two-col { grid-template-columns: 1fr; }
  .scheduled-add { grid-template-columns: 1fr; }
  .scheduled-add .daily-title-input, .scheduled-add .btn-primary { grid-column: auto; }
  .inline-check { justify-content: flex-start; }
  .daily-item { grid-template-columns: 40px minmax(0,1fr) 40px 40px; }
  .daily-meta { grid-column: 2 / -1; }
  .settings-title-row, .sms-panel-head, .sms-log-head { align-items: flex-start; }
  .sms-panel-head, .sms-log-head { flex-direction: column; }
  .compact-switch { align-self: stretch; justify-content: space-between; }
  .sms-actions, .sms-log-tools { width: 100%; flex-direction: column; }
  .sms-log-tools select, .sms-log-tools button { width: 100%; }
  .sms-log-row { grid-template-columns: 1fr; }
  .sms-log-times, .sms-log-row details { grid-column: 1; }
  .log-status { justify-self: start; }
  .log-detail-grid { grid-template-columns: 1fr; }
  .log-detail-grid p { grid-column: 1; }
}

/* ---------- Jalali calendar ---------- */
.jalali-field { position: relative; min-width: 0; }
.jalali-date-input { padding-left: 46px; cursor: pointer; caret-color: transparent; }
.jalali-open {
  position: absolute; left: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--blue);
  font-size: 18px; font-weight: 900;
}
.jalali-picker-modal { max-width: 390px; }
.jalali-picker-head { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; margin-bottom: 12px; }
.jalali-picker-head strong { text-align: center; font-size: 16px; }
.jalali-nav { width: 42px; height: 42px; border-radius: 11px; background: var(--surface-2); color: var(--blue); font-size: 25px; }
.jalali-weekdays, .jalali-calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; }
.jalali-weekdays { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 850; text-align: center; }
.jalali-calendar-grid { direction: rtl; }
.jalali-day, .jalali-empty { aspect-ratio: 1; min-height: 38px; border-radius: 10px; }
.jalali-day { background: var(--surface-2); color: var(--ink); border: 1px solid transparent; font-weight: 750; }
.jalali-day:hover { border-color: var(--orange); }
.jalali-day.today { border-color: var(--blue); color: var(--blue); }
.jalali-day.selected { background: var(--orange); color: #fff; border-color: var(--orange); }
.jalali-picker-foot { display: flex; gap: 8px; margin-top: 13px; }
.jalali-picker-foot button { flex: 1; min-height: 42px; border-radius: 11px; }
.sms-actions-three { flex-wrap: wrap; }
.sms-actions-three button { min-width: 150px; }

@media (max-width: 620px) {
  .jalali-picker-modal { max-width: 100%; }
  .jalali-day, .jalali-empty { min-height: 40px; }
  .sms-actions-three button { width: 100%; min-width: 0; }
}

/* ---------- v2.4: Panelchi + instruction exports ---------- */
.instruction-list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 7px;
}
.instruction-export-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-action {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 32px; padding: 5px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--blue);
  font-size: 11px; font-weight: 800; text-decoration: none;
}
.mini-action:hover { border-color: var(--blue); background: var(--surface-2); }
.sms-send-btn { color: var(--blue); }
.sms-send-btn:hover { background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); }
.sms-send-btn:disabled { opacity: .45; cursor: wait; }
.account-info-card {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px;
  margin-top: 14px; padding: 10px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface-2);
}
.account-info-card[hidden] { display: none !important; }
.account-info-card > div {
  min-width: 0; padding: 8px; border-radius: 9px; background: var(--surface);
}
.account-info-card span { display: block; color: var(--muted); font-size: 10.5px; }
.account-info-card strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 12.5px; }
.log-status.accepted { background: #e4f1ff; color: #07588f; }
.log-status.delivered { background: var(--success-soft); color: var(--success); }
.log-status.blocked { background: #fff0e5; color: #a34b00; }

@media (max-width:620px) {
  .instruction-list-head { align-items: flex-start; flex-direction: column; }
  .instruction-export-actions { width: 100%; }
  .mini-action { flex: 1; }
  .account-info-card { grid-template-columns: 1fr; }
}

/* ---------- v2.5: recurring processes + stage modules ---------- */
.process-shell {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 2.3fr);
  gap: 16px;
  align-items: start;
}
.process-list-panel,
.process-detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.process-list-panel {
  position: sticky;
  top: 22px;
  padding: 12px;
}
.process-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 4px 11px;
  color: var(--muted);
  font-size: 12px;
}
.process-list-head strong { color: var(--ink); font-size: 13px; }
.process-list-head span {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--blue);
  font-weight: 850;
}
.process-selector { display: grid; gap: 6px; }
.process-selector-item {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: right;
}
.process-selector-item:hover { background: var(--surface-2); }
.process-selector-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--orange) 24%, transparent);
}
.process-selector-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 820;
}
.process-selector-item small { color: var(--muted); white-space: nowrap; }
.process-detail-panel { padding: 18px; min-width: 0; }
.process-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.process-detail-title { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.process-loop-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 22px;
  font-weight: 900;
}
.process-detail-title h3 { margin: 0; font-size: 21px; overflow-wrap: anywhere; }
.process-detail-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.process-head-actions,
.stage-actions,
.stage-module-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.compact-button { padding: 7px 11px; min-height: 34px; border-radius: 9px; font-size: 12px; }
.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 18%, transparent);
  border-radius: 10px;
  padding: 9px 13px;
  font-weight: 800;
}
.danger-button:disabled { opacity: .45; }
.text-danger-button {
  background: transparent;
  color: var(--danger);
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 800;
}
.text-danger-button:hover { background: var(--danger-soft); }
.process-stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 17px 0 12px;
}
.process-stage-toolbar div { display: grid; }
.process-stage-toolbar span { color: var(--muted); font-size: 11.5px; }
.process-stages { display: grid; gap: 11px; }
.process-stage-card {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: var(--surface-2);
}
.stage-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface);
  color: var(--blue);
  border: 1px solid var(--line);
  font-weight: 900;
}
.stage-content { min-width: 0; }
.stage-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.stage-title-row h4 { margin: 0; font-size: 15px; }
.stage-title-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.stage-module-empty,
.stage-module-card {
  margin-top: 12px;
  padding: 11px;
  border-radius: 13px;
  border: 1px dashed color-mix(in srgb, var(--blue) 28%, var(--line));
  background: var(--surface);
}
.stage-module-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stage-module-empty div { display: grid; }
.stage-module-empty strong { font-size: 12.5px; }
.stage-module-empty span { color: var(--muted); font-size: 11px; }
.stage-module-card {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  border-style: solid;
}
.stage-module-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}
.stage-module-info { min-width: 0; }
.stage-module-info strong { display: block; font-size: 13px; }
.stage-module-info span { display: block; color: var(--muted); font-size: 10.5px; }
.stage-module-info p { margin: 4px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.stage-module-actions button { min-height: 34px; padding: 7px 10px; border-radius: 9px; font-size: 11px; }
.stage-empty-state,
.process-empty {
  text-align: center;
  padding: 42px 18px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  background: var(--surface-2);
}
.stage-empty-state h4,
.process-empty h3 { margin: 0; }
.stage-empty-state p,
.process-empty p { color: var(--muted); margin: 5px 0 15px; }
.process-empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 11px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 30px;
}

.module-install-section h4 { margin: 12px 0 0; }
.module-attach-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; }
.module-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; color: var(--muted); font-size: 11px; }
.module-or::before,
.module-or::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.modal-module-workspace { max-width: 1040px; max-height: min(90dvh,900px); overflow: hidden; display: flex; flex-direction: column; }
.module-workspace-head { flex: 0 0 auto; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.module-workspace-head p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.module-workspace-body { min-height: 220px; overflow: auto; padding-top: 15px; }
.module-empty-state { text-align: center; padding: 35px 15px; color: var(--muted); }
.module-manager-list { display: grid; gap: 10px; margin-top: 14px; max-height: 520px; overflow: auto; }
.module-manager-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.module-manager-main { min-width: 0; }
.module-manager-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.module-manager-title span {
  border-radius: 20px;
  padding: 2px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
}
.module-manager-title .module-warning-badge { background: var(--danger-soft); color: var(--danger); }
.module-manager-main > p { margin: 5px 0; color: var(--muted); font-size: 11.5px; }
.module-manager-meta { display: flex; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: 10.5px; }
.module-locations { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.module-locations span { padding: 3px 8px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); font-size: 10.5px; }

/* Shared styles available to trusted process modules */
.module-ui-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.module-ui-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 13px; }
.module-ui-card h4 { margin: 0 0 9px; }
.module-ui-metric { display: grid; gap: 2px; }
.module-ui-metric span { color: var(--muted); font-size: 11px; }
.module-ui-metric strong { font-size: 20px; color: var(--blue); }
.module-ui-form { display: grid; gap: 10px; }
.module-ui-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.module-ui-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.module-ui-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
.module-ui-table { width: 100%; border-collapse: collapse; min-width: 620px; }
.module-ui-table th,
.module-ui-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; font-size: 12px; }
.module-ui-table th { background: var(--surface-2); color: var(--muted); }
.module-ui-table tr:last-child td { border-bottom: 0; }

@media (max-width: 900px) {
  .process-shell { grid-template-columns: 1fr; }
  .process-list-panel { position: static; }
  .process-selector { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stage-module-card { grid-template-columns: 40px minmax(0,1fr); }
  .stage-module-actions { grid-column: 1 / -1; }
  .module-ui-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .process-selector { grid-template-columns: 1fr; }
  .process-detail-panel { padding: 13px; }
  .process-detail-head,
  .process-stage-toolbar,
  .stage-title-row,
  .stage-module-empty,
  .module-manager-card { flex-direction: column; align-items: stretch; }
  .process-head-actions,
  .stage-actions { width: 100%; }
  .process-head-actions .compact-button { flex: 1; }
  .process-stage-card { grid-template-columns: 34px minmax(0,1fr); padding: 10px; gap: 8px; }
  .stage-number { width: 34px; height: 34px; border-radius: 10px; }
  .stage-module-card { grid-template-columns: 36px minmax(0,1fr); }
  .stage-module-icon { width: 36px; height: 36px; }
  .stage-module-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .stage-module-actions .text-danger-button { grid-column: 1 / -1; }
  .module-attach-row,
  .module-ui-form-grid,
  .module-ui-grid { grid-template-columns: 1fr; }
  .module-manager-card > button { width: 100%; }
  .modal-module-workspace { max-height: 94dvh; }
}
