:root {
  --bg: #0f1012;
  --surface: #17191d;
  --surface-2: #1d2024;
  --text: #f1f2f4;
  --muted: #a4a9b3;
  --line: #2a2f36;
  --accent: #f2a52b;
  --green: #27db19;
  --red: #f0544f;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% -20%, #21252d 0%, var(--bg) 45%);
}

body { min-height: 100vh; }

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 14px 12px 180px;
}

.topbar,
.activities-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.topbar { justify-content: space-between; }

.topbar h1,
.activities-toolbar h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  color: #e9ebef;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  background: #121417;
  color: #c8ccd4;
  cursor: pointer;
}

.icon-btn.small {
  width: 34px;
  height: 34px;
}

.icon-btn.active {
  color: #4cb1ff;
  border-color: #3b82f6;
}

.pill-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #121417;
  color: #e0e4eb;
  height: 34px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}

.pill-btn.active {
  color: #4cb1ff;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #303643;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 64px;
}

.meta {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.day-list,
.activities-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.month-divider {
  margin-top: 6px;
  margin-bottom: 2px;
  padding-left: 2px;
  padding-right: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8f96a3;
}

.day-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #13161a;
  padding: 11px;
}

.day-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
}

.day-date {
  margin: 0;
  font-size: 0.95rem;
  color: #eef1f7;
}

.day-right { text-align: right; }

.day-hours {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.day-card.overtime-day {
  border-color: #6a2a2a;
  background: linear-gradient(180deg, #1f1315 0%, #151012 100%);
}

.day-card.overtime-day .day-date,
.day-card.overtime-day .day-hours {
  color: #ff7c7c;
  font-weight: 700;
}

.day-chevron {
  color: #9ba2af;
  font-size: 0.9rem;
  margin-left: 10px;
}

.day-details { margin-top: 8px; }

.progress-track {
  margin-top: 10px;
  width: 100%;
  height: 4px;
  background: #2a3038;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #d59126, var(--accent));
}

.day-sessions {
  margin-top: 9px;
  display: grid;
  gap: 6px;
}

.session {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: #cfd3da;
}

.session-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-btn {
  border: 1px solid #3a4250;
  border-radius: 999px;
  background: #20252d;
  color: #d7dbe3;
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
}

.delete-mini-btn {
  border: 1px solid #5b2f34;
  border-radius: 999px;
  background: #2a171a;
  color: #ff7b86;
  font-size: 0.75rem;
  padding: 4px 8px;
  line-height: 1;
  cursor: pointer;
}

.session small { color: #9097a3; }

.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 10px;
  border-bottom: 1px solid #2a3038;
  border-radius: 8px;
}

.activity-row:last-child { border-bottom: none; }

.activity-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}

.activity-name {
  margin: 0;
  font-size: 1rem;
}

.activity-sub {
  margin: 2px 0 0;
  color: #88909d;
  font-size: 0.82rem;
}

.activity-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.activity-btn {
  border: 1px solid #3a4250;
  border-radius: 999px;
  background: #20252d;
  color: #d7dbe3;
  font-size: 0.75rem;
  padding: 5px 10px;
  cursor: pointer;
}

.chevron {
  color: #7e8695;
}

.action-btn {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 74px;
  border: none;
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 1.02rem;
  font-weight: 700;
  color: #08230b;
  background: linear-gradient(180deg, #3bff26 0%, var(--green) 100%);
  box-shadow: 0 12px 30px rgba(39, 219, 25, 0.38);
  cursor: pointer;
  z-index: 30;
}

.action-btn.stop {
  color: #2b0909;
  background: linear-gradient(180deg, #ff8c87 0%, var(--red) 100%);
  box-shadow: 0 12px 30px rgba(240, 84, 79, 0.33);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62px;
  background: #121418;
  border-top: 1px solid #282d34;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  text-align: center;
  z-index: 20;
}

.tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #7f8693;
  font-size: 0.68rem;
  padding: 4px 6px;
}

.tab.active {
  color: #39a8ff;
  font-weight: 600;
}

.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  z-index: 40;
  display: flex;
  align-items: flex-end;
}

.modal-card {
  width: min(760px, 100%);
  margin: 0 auto;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border: 1px solid var(--line);
  border-bottom: none;
  background: #111317;
  padding: 14px 12px 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.save-btn {
  border: none;
  border-radius: 999px;
  background: #0a84ff;
  color: #fff;
  padding: 8px 14px;
  font-weight: 700;
}

.meta-list {
  margin-top: 10px;
  border: 1px solid #2b3138;
  border-radius: 10px;
  overflow: hidden;
}

.meta-list > div {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: #1a1d22;
  border-top: 1px solid #2b3138;
  font-size: 0.9rem;
}

.meta-list > div:first-child { border-top: none; }
.meta-list span { color: var(--muted); }

.cancel-btn,
.delete-btn {
  margin-top: 14px;
  width: 100%;
  border-radius: 12px;
  padding: 11px;
  font-weight: 700;
}

.dialog-card {
  padding-bottom: 14px;
}

.dialog-message {
  margin: 4px 0 10px;
  color: #d5dae2;
  font-size: 0.92rem;
}

.dialog-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.dialog-btn {
  margin-top: 0;
  width: auto;
  min-width: 110px;
}

.dialog-color-wrap {
  margin-top: 8px;
}

.dialog-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#dialogColorInput {
  width: 56px;
  min-width: 56px;
  height: 40px;
  border-radius: 10px;
  padding: 0;
  border: 1px solid #3a4250;
  background: #1a1f26;
}

.dialog-color-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #3a4250;
  border-radius: 10px;
  color: #d9dee6;
  background: #1a1f26;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
}

.menu-drawer-card {
  width: min(360px, 88vw);
  height: 100%;
  background: #12151a;
  border-right: 1px solid #2b313a;
  padding: 14px 10px;
  overflow: auto;
}

#menuDrawer {
  align-items: stretch;
  justify-content: flex-start;
}

.menu-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: 1px solid #313844;
  border-radius: 12px;
  background: #1b2028;
  color: #e5e9f0;
  padding: 12px 12px;
  font-size: 0.92rem;
  cursor: pointer;
}

.menu-item:active {
  transform: translateY(1px);
}

.cancel-btn {
  border: 1px solid #3a414b;
  background: #15181d;
  color: #ff6565;
}

.delete-btn {
  border: 1px solid #5a2d2d;
  background: #2a1414;
  color: #ff7f7f;
}

@media (min-width: 761px) {
  .action-btn {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 736px;
  }
}

@media (max-width: 420px) {
  .topbar h1,
  .activities-toolbar h2 {
    font-size: 0.94rem;
  }

  .tab {
    font-size: 0.62rem;
  }
}
