:root {
  --black: #000000;
  --white: #ffffff;
  --line: #8f8f8f;
  --border: #1d1d1d;
  --soft-line: #e8e8e8;
  --muted: #667585;
  --dot: rgba(0, 0, 0, 0.46);
  --danger: #b00020;
  --success: #087a36;
  --blue-shadow: #088eea;
  --sheet-line: #d9dfe5;
  --sheet-gray: #f5f5f5;
  --sheet-green: #16a34a;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--white);
  color: var(--black);
  font-family: Arial, Tahoma, sans-serif;
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; background: transparent; border: 0; color: inherit; padding: 0; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; background: var(--white); }
.dotted {
  background-color: var(--white);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 8px 0;
}

/* Login */
.top-login {
  height: 53px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfb;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  direction: ltr;
  padding: 0 19px;
}
.auth-actions { display: flex; align-items: center; gap: 22px; direction: ltr; }
.join-btn {
  width: 79px; height: 34px; background: var(--black); color: var(--white);
  border: 1px solid var(--black); font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px; font-weight: 900; letter-spacing: 0.2px; line-height: 32px; text-align: center;
}
.signin-link {
  height: 34px; border-bottom: 2px solid var(--black);
  font-size: 14px; font-weight: 900; letter-spacing: 0.5px; line-height: 31px;
}
.login-page {
  min-height: calc(100vh - 53px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 61px; border-bottom: 1px solid var(--line);
}
.auth-card {
  width: 424px; min-height: 510px; background: var(--white);
  border: 2px solid var(--border); box-shadow: 2px 2px 0 rgba(0,0,0,.88);
  position: relative; padding: 28px 22px 26px; direction: ltr;
}
.corner-square { position: absolute; width: 22px; height: 22px; background: var(--black); left: -13px; top: -13px; }
.auth-card h1 {
  margin: 0; font-family: Tahoma, Arial, sans-serif; font-size: 34px; line-height: 1.25;
  font-weight: 900; letter-spacing: -1.7px; direction: rtl; text-align: left;
  text-shadow: 2px 2px 0 var(--blue-shadow);
}
.title-line { display: block; width: 45px; height: 4px; background: var(--black); margin: 15px 0 57px; }
.form-row { margin-bottom: 23px; }
.form-row label, .forgot-btn { font-size: 14px; font-weight: 900; letter-spacing: 0.15px; }
.form-row > label { display: block; margin-bottom: 8px; }
.label-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.forgot-btn { color: #555; text-transform: uppercase; }
.auth-card input {
  width: 100%; height: 55px; border: 2px solid #8b8b8b; border-radius: 0;
  padding: 0 16px; background: var(--white) !important; color: var(--black);
  font-size: 16px; outline: 0; direction: ltr; box-shadow: none;
}
.auth-card input::placeholder { color: #6f7f91; opacity: 1; }
.auth-card input:focus { border-color: var(--black); }
.main-auth-btn {
  width: 100%; height: 50px; background: var(--black); color: var(--white);
  border: 1px solid var(--black); direction: rtl; font-size: 14px; font-weight: 900;
}
.auth-message { min-height: 22px; margin: 12px 0 0; font-size: 13px; font-weight: 700; direction: rtl; text-align: right; }
.auth-message.error { color: var(--danger); }
.auth-message.success { color: var(--success); }
.auth-divider { height: 1px; background: var(--soft-line); margin: 25px 0 0; }

/* Main app */
.tracker-page, .monthly-page, .monthly-detail-page { min-height: 100vh; position: relative; padding-bottom: 60px; }
.tracker-header {
  height: 56px; background: #fafafa; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.tracker-header h1 {
  position: absolute; right: 63px; margin: 0; font-size: 33px; font-weight: 900;
  line-height: 1; letter-spacing: -0.7px;
}
.left-icons { position: absolute; left: 18px; display: flex; align-items: center; gap: 12px; direction: ltr; }
.mini-icon { width: 20px; height: 22px; font-size: 21px; line-height: 1; display: grid; place-items: center; }

.tasks-board {
  min-height: calc(100vh - 115px); padding: 56px 18px 60px;
  display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 20px; direction: ltr;
}
.task-card {
  height: 265px; background: var(--white); border: 1px solid var(--soft-line);
  box-shadow: 0 1px 4px rgba(0,0,0,.15); position: relative;
  display: grid; place-items: center; overflow: hidden;
}
.task-card.current-week {
  outline: 3px solid var(--black);
  outline-offset: -3px;
}
.task-label {
  position: absolute; top: 18px; right: 20px; direction: rtl;
  font-size: 13px; font-weight: 900; opacity: .7;
}
.task-number {
  display: block; transform: translateY(-8px);
  font-size: 102px; line-height: 1; font-weight: 900; letter-spacing: -3px;
}
.week-range-label {
  position: absolute; bottom: 22px; right: 20px; direction: rtl;
  font-size: 12px; font-weight: 700; color: #555;
}
.card-arrow {
  position: absolute; bottom: 19px; left: 14px; width: 32px; height: 32px;
  border: 1px solid #d8d8d8; background: var(--white); font-size: 27px;
  line-height: 25px; display: grid; place-items: center;
}
.card-arrow:hover, .card-arrow:focus { border-color: var(--black); }

/* monthly log */
.monthly-shell, .detail-shell { width: min(1360px, calc(100% - 28px)); margin: 0 auto; padding: 14px 0 40px; }
.summary-topbar, .detail-topbar { display: flex; justify-content: flex-start; margin-bottom: 12px; }
.tiny-back-btn { border: 1px solid var(--black); padding: 7px 14px; font-size: 13px; font-weight: 700; background: var(--white); }
.stats-strip { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; direction: ltr; }
.stat-box {
  min-height: 74px; border: 2px solid var(--border); box-shadow: 3px 3px 0 rgba(0,0,0,.95);
  background: var(--white); position: relative; padding: 12px 18px;
}
.stat-box-dark { background: var(--black); color: var(--white); }
.stat-dot { position: absolute; left: 10px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--black); }
.stat-label { font-size: 13px; font-weight: 700; letter-spacing: .5px; color: inherit; }
.stat-subtext { position: absolute; left: 16px; bottom: 14px; font-size: 12px; font-weight: 700; opacity: .9; }
.stat-value { position: absolute; right: 18px; bottom: 10px; font-size: 23px; font-weight: 900; letter-spacing: -.3px; }
.months-grid { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 14px; }
.month-record-card {
  height: 160px; background: var(--white); border: 2px solid var(--border);
  box-shadow: 3px 3px 0 rgba(0,0,0,.95); position: relative; padding: 16px 16px 14px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.month-record-card.current-month { outline: 3px solid var(--black); outline-offset: -8px; }
.month-record-card .month-no { font-size: 18px; font-weight: 900; line-height: 1; text-align: right; }
.month-record-card .month-name { font-size: 27px; font-weight: 900; line-height: 1.2; text-align: center; margin-top: 4px; }
.month-card-footer { display: flex; flex-direction: column; gap: 6px; }
.month-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.month-progress { width: 100%; height: 4px; background: #e7e7e7; position: relative; overflow: hidden; }
.month-progress span { position: absolute; right: 0; top: 0; bottom: 0; background: var(--black); }

/* monthly detail */
.detail-hero { padding: 10px 6px 10px; }
.hero-copy { text-align: right; }
.hero-copy h2 { margin: 0; font-size: 36px; font-weight: 900; line-height: 1.15; }
.hero-copy p { margin: 6px 0 0; font-size: 28px; font-weight: 700; color: #6f6f6f; }
.hero-copy p strong { color: var(--black); font-size: 36px; margin-right: 10px; }
.hero-divider { height: 2px; background: rgba(0,0,0,.65); margin-bottom: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 20px; margin-bottom: 22px; }
.week-card {
  min-height: 475px; border: 2px solid var(--border); box-shadow: 3px 3px 0 rgba(0,0,0,.95);
  background: var(--white); display: flex; flex-direction: column; overflow: hidden;
}
.week-header { min-height: 64px; background: #ebebeb; border-bottom: 1px solid #8b8b8b; text-align: center; padding: 14px 10px 10px; }
.week-card.active-week .week-header { background: var(--black); color: var(--white); }
.week-title { font-size: 19px; font-weight: 800; line-height: 1.1; margin-bottom: 4px; }
.week-range { font-size: 13px; color: #676767; }
.week-card.active-week .week-range { color: rgba(255,255,255,.78); }
.week-body { padding: 12px 14px 12px; flex: 1; }
.week-task { padding: 18px 0; border-bottom: 1px solid #ebebeb; }
.task-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-title { font-size: 17px; line-height: 1.7; flex: 1; }
.task-date { margin-top: 2px; font-size: 13px; color: #6b6b6b; }
.task-check {
  width: 18px; height: 18px; border: 1px solid #666; display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; line-height: 1; color: transparent; flex-shrink: 0; margin-top: 3px;
}
.week-task.done .task-check { background: var(--black); color: var(--white); border-color: var(--black); }
.week-task.done .task-title, .week-task.done .task-date { color: #959595; text-decoration: line-through; }
.detail-summary { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr); gap: 20px; }
.summary-card {
  min-height: 126px; border: 2px solid var(--border); box-shadow: 3px 3px 0 rgba(0,0,0,.95);
  padding: 18px 22px; display: flex; align-items: center; justify-content: space-between;
}
.summary-card-dark { background: var(--black); color: var(--white); display: block; }
.summary-icon { font-size: 40px; line-height: 1; }
.summary-small { font-size: 15px; font-weight: 700; color: inherit; }
.summary-big { font-size: 54px; font-weight: 900; line-height: 1; margin-top: 10px; }
.summary-big.white { color: var(--white); }
.right-align { text-align: right; }
.summary-progress { margin-top: 18px; width: 100%; height: 6px; background: rgba(255,255,255,.2); position: relative; }
.summary-progress span { position: absolute; top: 0; right: 0; bottom: 0; background: var(--white); }

/* Habit one-week sheet */
.habit-sheet-page {
  min-height: 100vh;
  background: #fff;
  color: #000;
  direction: ltr;
  padding-bottom: 54px;
}
.sheet-stage {
  width: 100%;
  min-height: calc(100vh - 54px);
  background: #fff;
  padding: 34px 44px 48px;
}
.sheet-canvas {
  min-width: 1040px;
  max-width: 1500px;
  margin: 0 auto;
  background: #fff;
}
.sheet-local-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.sheet-back-btn {
  height: 34px;
  padding: 0 18px;
  border: 1px solid #dadce0;
  border-radius: 18px;
  background: #fff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
#activeWeekBadge {
  font-weight: 800;
  color: #444;
  padding: 7px 14px;
  background: #f6f6f6;
  border: 1px solid #e0e0e0;
}
.habit-main-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2.2fr;
  align-items: start;
  margin-bottom: 42px;
}
.habit-main-head h1 {
  margin: 0;
  font-size: 41px;
  font-weight: 400;
  letter-spacing: -1.2px;
}
.top-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 46px;
  align-items: center;
  text-align: center;
}
.metric span {
  display: block;
  font-size: 18px;
  margin-bottom: 10px;
}
.metric strong {
  display: block;
  font-size: 24px;
  font-weight: 900;
}
.progress-metric {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}
.sheet-progress {
  width: 255px;
  height: 20px;
  border: 1px solid #888;
  background: linear-gradient(90deg, #f7f7f7 0%, #f7f7f7 50%, #777 50%, #777 100%);
  margin: 0 auto 0;
  position: relative;
}
.sheet-progress span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--sheet-green);
}
.habit-template-grid {
  display: grid;
  grid-template-columns: 194px 1fr 270px;
  gap: 14px;
  align-items: stretch;
}
.habit-list-panel, .days-panel, .analysis-panel {
  border: 1px solid var(--sheet-line);
  background: #fbfbfb;
}
.habit-list-panel h2, .analysis-panel h2 {
  height: 52px;
  margin: 0;
  display: grid;
  place-items: center;
  background: #f5f5f5;
  border-bottom: 1px solid var(--sheet-line);
  font-size: 21px;
}
.empty-habit-rows {
  padding-top: 28px;
}
.habit-name-row {
  height: 25px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--sheet-line);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.habit-title-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #000;
  font-size: 14px;
  font-weight: 700;
  padding: 0 2px;
  direction: rtl;
  outline: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.habit-title-input[readonly] {
  cursor: default;
  user-select: none;
}
.edit-mode .habit-name-row:not(.empty-row) {
  background: #fffdf7;
}
.edit-mode .habit-title-input {
  border-color: #cfcfcf;
  background: #fff;
  padding: 0 7px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}
.edit-mode .habit-title-input:focus {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}
.inline-delete-task {
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border: 1px solid #b7b7b7;
  border-radius: 4px;
  background: #fff;
  color: #9b1c1c;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  display: none;
  place-items: center;
  flex: 0 0 auto;
  opacity: .78;
}
.edit-mode .inline-delete-task {
  display: inline-grid;
}
.inline-delete-task:hover {
  opacity: 1;
  border-color: #9b1c1c;
  background: #fff5f5;
}

.habit-name-row.empty-row {
  color: transparent;
}
.days-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}
.days-table th, .days-table td {
  cursor: pointer;
  border: 1px solid var(--sheet-line);
  height: 24px;
  text-align: center;
  font-size: 13px;
  padding: 0;
}
.days-table thead th {
  background: #f7f7f7;
  font-weight: 900;
}
.days-table .week-title-cell {
  height: 28px;
  font-size: 15px;
  background: #f5f5f5;
  border-bottom: 1px solid var(--sheet-line);
}
.days-table .today-col {
  background: #eaf3ff;
}
.habit-check {
  width: 17px;
  height: 17px;
  border: 2px solid #5f6f5f;
  display: inline-grid;
  place-items: center;
  margin: 2px auto 0;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  color: transparent;
  background: #fff;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.habit-check:hover {
  border-color: #16833b;
  box-shadow: 0 0 0 3px rgba(22, 131, 59, .14);
}
.habit-check.checked {
  background: #0f9f4a;
  color: #fff;
  border-color: #0b7f3a;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 0 0 2px rgba(15,159,74,.16);
}
.analysis-panel table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.analysis-panel th, .analysis-panel td {
  height: 24px;
  border: 1px solid var(--sheet-line);
  text-align: center;
  font-size: 13px;
}
.analysis-panel thead th {
  font-weight: 900;
  background: #fff;
}
.analysis-progress {
  height: 17px;
  background: #f1f1f1;
  position: relative;
  margin: 0 10px;
}
.analysis-progress span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--sheet-green);
}

/* One-time goals: fixed tasks completed once only */
.one-time-goals-section {
  margin-top: 14px;
  border: 1px solid var(--sheet-line);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(0,0,0,.02);
}
.one-time-goals-section.hidden { display: none !important; }
.one-time-goals-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #f7f7f7;
  border-bottom: 1px solid var(--sheet-line);
  font-weight: 900;
}
.one-time-goals-head strong {
  font-size: 15px;
}
.one-time-goals-head span {
  color: #666;
  font-size: 12px;
  font-weight: 800;
}
.one-time-goals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 0;
}
.one-time-goal-card {
  min-height: 58px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-left: 1px solid var(--sheet-line);
  border-bottom: 1px solid var(--sheet-line);
  background: #fff;
}
.one-time-goal-card:nth-child(3n) { border-left: 0; }
.one-time-goal-check {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #5f6f5f;
  background: #fff;
  color: transparent;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.one-time-goal-check:hover {
  border-color: #16833b;
  box-shadow: 0 0 0 3px rgba(22, 131, 59, .14);
}
.one-time-goal-check.checked {
  background: #0f9f4a;
  color: #fff;
  border-color: #0b7f3a;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 0 0 2px rgba(15,159,74,.16);
}
.one-time-goal-title {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #000;
  font-size: 14px;
  font-weight: 900;
  direction: rtl;
  outline: 0;
  padding: 6px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.one-time-goal-title[readonly] {
  cursor: default;
  user-select: none;
}
.one-time-goal-card.done .one-time-goal-title {
  text-decoration: line-through;
  color: #555;
}
.edit-mode .one-time-goal-card {
  background: #fffdf7;
}
.edit-mode .one-time-goal-title {
  border-color: #cfcfcf;
  background: #fff;
  padding: 6px 8px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}
.edit-mode .one-time-goal-title:focus {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}
.one-time-goal-delete {
  width: 22px;
  height: 22px;
  border: 1px solid #b7b7b7;
  border-radius: 6px;
  background: #fff;
  color: #9b1c1c;
  font-size: 15px;
  line-height: 1;
  font-weight: 900;
  display: none;
  place-items: center;
}
.edit-mode .one-time-goal-delete {
  display: inline-grid;
}
.one-time-goal-delete:hover {
  border-color: #9b1c1c;
  background: #fff5f5;
}
.task-mode-label {
  display: block;
  margin: 0 0 8px;
  font-weight: 900;
  font-size: 13px;
}
.modal-box select#taskModeSelect {
  border-radius: 0;
}

.daily-strip {
  display: grid;
  grid-template-columns: 194px 1fr;
  margin-top: 14px;
}
.daily-labels {
  background: #f7f7f7;
  border: 1px solid var(--sheet-line);
  font-weight: 900;
  padding: 10px 16px;
  line-height: 1.8;
}
.daily-values {
  display: grid;
  border-top: 1px solid var(--sheet-line);
  border-bottom: 1px solid var(--sheet-line);
}
.daily-value-col {
  display: grid;
  grid-template-rows: repeat(3, 28px);
  border-right: 1px solid var(--sheet-line);
  text-align: center;
  font-weight: 900;
  font-size: 14px;
}
.daily-value-col div {
  display: grid;
  place-items: center;
}
.line-chart-placeholder {
  height: 104px;
  margin: 20px 0 14px 194px;
  border: 1px solid var(--sheet-line);
  position: relative;
  overflow: visible;
  /* خطوط الشبكة الآن موزونة على كامل ارتفاع الرسم: 100/75/50/25/0 */
  background:
    linear-gradient(to bottom, transparent calc(25% - .5px), #e8e8e8 25%, transparent calc(25% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), #e8e8e8 50%, transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(75% - .5px), #e8e8e8 75%, transparent calc(75% + .5px));
}
.chart-axis {
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-weight: 900;
}
.empty-chart-line {
  position: absolute;
  left: 64px;
  right: 14px;
  top: 0;
  bottom: 0;
  background: transparent;
  overflow: visible;
}

.weekly-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.weekly-chart-area {
  fill: rgba(22, 163, 74, 0.34);
}

.weekly-chart-line {
  fill: none;
  stroke: #0b7a2f;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(11, 122, 47, 0.30));
}

.weekly-chart-dot {
  fill: #0b7a2f;
  stroke: #ffffff;
  stroke-width: 2;
}
.weekly-stats {
  display: grid;
  grid-template-columns: 194px 1fr;
  align-items: end;
}
.weekly-stats aside {
  border: 1px solid var(--sheet-line);
  background: #f7f7f7;
  min-height: 58px;
  padding: 8px 12px;
  font-size: 13px;
}
.weekly-stats h3 { margin: 0 0 4px; font-size: 14px; }
.legend-done, .legend-empty {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-done { background: #16a34a; }
.legend-empty { background: #ddd; }
.weekly-bars {
  display: grid;
  align-items: end;
  gap: 8px;
  height: 58px;
  padding: 0 12px;
  border: 1px solid var(--sheet-line);
  border-left: 0;
}
.weekly-bar-wrap {
  height: 48px;
  display: flex;
  align-items: end;
  justify-content: center;
}
.weekly-bar {
  width: 18px;
  min-height: 4px;
  background: #16a34a;
  box-shadow: 0 0 0 1px rgba(11, 122, 47, 0.12);
}
.no-data-message {
  padding: 18px 12px;
  font-size: 13px;
  color: #777;
}

/* footer & modal */
.tracker-footer {
  height: 44px; background: #fbfbfb; border-top: 1px solid var(--line);
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; font-size: 11px; font-weight: 700; z-index: 8;
}
.tracker-footer nav { display: flex; align-items: center; gap: 14px; }
.footer-brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 210px;
}
.current-user-badge {
  direction: ltr;
  color: #555;
  font-size: 10px;
  font-weight: 800;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tracker-footer button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 999px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.tracker-footer button:hover {
  text-decoration: none;
  background: #f0f0f0;
}
.footer-icon-btn {
  border: 1px solid #d8d8d8 !important;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.footer-icon-btn.active {
  background: #111;
  color: #fff;
  border-color: #111 !important;
}
.footer-pencil {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 12px;
  line-height: 1;
}
.edit-only-action { display: none !important; }
.edit-mode .edit-only-action { display: inline-flex !important; }
.footer-danger-btn {
  color: #9b1c1c;
  border: 1px solid #f0d0d0 !important;
  background: #fff8f8;
}
.editing-active {
  box-shadow: 0 -4px 14px rgba(0,0,0,.06);
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 20;
}
.modal-box {
  width: min(470px, calc(100vw - 30px)); background: var(--white); border: 3px solid var(--black);
  box-shadow: 4px 4px 0 var(--black); padding: 28px; position: relative;
}
.close-modal { position: absolute; left: 16px; top: 12px; font-size: 28px; line-height: 1; font-weight: 900; }
.modal-box h2 { margin: 0 0 18px; font-size: 30px; font-weight: 900; }
.modal-box p { margin: 0 0 22px; line-height: 1.9; font-size: 14px; }
.modal-box input {
  width: 100%; height: 52px; border: 2px solid var(--black); padding: 0 14px;
  margin-bottom: 14px; direction: rtl; outline: 0;
}
.modal-box select {
  width: 100%;
  min-height: 52px;
  border: 2px solid var(--black);
  padding: 0 14px;
  margin-bottom: 14px;
  direction: rtl;
  outline: 0;
  background: #fff;
  font-weight: 800;
}
.save-task { width: 100%; height: 50px; background: var(--black); color: var(--white); font-weight: 900; font-size: 18px; }
.delete-task {
  width: 100%;
  height: 50px;
  background: #9b1c1c;
  color: var(--white);
  font-weight: 900;
  font-size: 18px;
}
.delete-task.disabled,
.delete-task:disabled {
  background: #999;
  cursor: not-allowed;
}
.save-hint { min-height: 20px; font-weight: 800; color: var(--success); margin-top: 14px !important; }
.zero-bar { min-height: 0 !important; }

@media (max-width: 1180px) {
  .months-grid, .detail-grid, .tasks-board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .sheet-stage { overflow-x: auto; padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 760px) {
  .top-login { padding: 0 12px; }
  .login-page { padding: 44px 16px 30px; }
  .auth-card { width: min(424px, 100%); min-height: 500px; }
  .auth-card h1 { font-size: 30px; }
  .tracker-header h1 { right: 15px; font-size: 26px; }
  .stats-strip, .months-grid, .detail-grid, .detail-summary, .tasks-board { grid-template-columns: 1fr; }
  .tracker-footer {
    height: auto; padding: 10px 14px; align-items: flex-start;
    gap: 10px; flex-direction: column-reverse;
  }
  .footer-brand-wrap { align-items: flex-start; min-width: 0; }
  .current-user-badge { max-width: calc(100vw - 30px); }
  .tracker-footer nav { flex-wrap: wrap; gap: 10px; }
  .hero-copy h2 { font-size: 29px; }
  .hero-copy p, .hero-copy p strong { font-size: 28px; }
}

/* Delegation modal */
.delegation-footer-btn {
  border-color: #111 !important;
}
.footer-delegate-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 12px;
  line-height: 1;
  transform: rotate(180deg);
}
.delegation-modal-box {
  width: min(640px, calc(100vw - 30px));
}
.delegation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 10px;
  font-size: 13px;
  font-weight: 900;
}
.delegation-toolbar button {
  border: 1px solid #d8d8d8;
  border-radius: 999px;
  padding: 7px 13px;
  background: #fff;
  font-weight: 900;
  font-size: 12px;
}
.delegation-users-list {
  max-height: 255px;
  overflow: auto;
  border: 2px solid var(--black);
  background: #fff;
  margin-bottom: 14px;
}
.delegation-user-item {
  min-height: 52px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #e5e5e5;
  cursor: pointer;
  transition: background .16s ease;
}
.delegation-user-item:last-child { border-bottom: 0; }
.delegation-user-item:hover { background: #f7f7f7; }
.delegation-user-item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #111;
}
.delegation-email {
  direction: ltr;
  text-align: left;
  font-weight: 900;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delegation-remove-user {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #f0d0d0 !important;
  background: #fff8f8;
  color: #9b1c1c;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
}
.delegation-empty {
  padding: 18px;
  color: #666;
  line-height: 1.8;
  font-weight: 800;
  text-align: center;
}
.save-task.disabled,
.save-task:disabled {
  background: #999;
  cursor: not-allowed;
}
@media (max-width: 760px) {
  .delegation-user-item {
    grid-template-columns: 28px 1fr;
  }
  .delegation-remove-user {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 1180px) {
  .one-time-goals-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
  .one-time-goal-card:nth-child(3n) { border-left: 1px solid var(--sheet-line); }
  .one-time-goal-card:nth-child(2n) { border-left: 0; }
}
@media (max-width: 760px) {
  .one-time-goals-head { align-items: flex-start; flex-direction: column; }
  .one-time-goals-grid { grid-template-columns: 1fr; }
  .one-time-goal-card { border-left: 0; }
}

/* Monthly log now displays completed one-time goals only */
.week-task.goal-only-task .task-title,
.week-task.goal-only-task .task-date {
  text-decoration: none;
  color: #111;
}
.week-task.goal-only-task .task-date {
  color: #666;
}
