﻿    :root {
      --bg: #f6f7f4;
      --panel: #ffffff;
      --text: #1f271f;
      --muted: #8a9188;
      --line: #e8ece4;
      --green: #61c38b;
      --green-dark: #239456;
      --yellow: #f4cd57;
      --blue: #5aa7e8;
      --gray: #d8ded5;
      --shadow: 0 12px 35px rgba(20, 40, 25, .10);
      --radius: 22px;
      --safe-bottom: env(safe-area-inset-bottom, 0px);
    }

    body.dark-mode {
      --bg: #141713;
      --panel: #20251f;
      --text: #eef4ec;
      --muted: #9aa495;
      --line: #343b32;
      --gray: #4b5348;
      --shadow: 0 12px 35px rgba(0, 0, 0, .34);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
      color: var(--text);
      background: var(--bg);
    }

    body.auth-pending .app-shell,
    body.auth-signed-out .app-shell {
      display: none;
    }

    body.auth-pending .auth-page {
      display: none;
    }

    body.auth-signed-in .auth-page {
      display: none;
    }

    .auth-page {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 24px;
      box-sizing: border-box;
      background: var(--bg);
    }

    .auth-page::before {
      content: none;
    }

    .auth-card {
      width: min(350px, 100%);
      border-radius: 22px;
      padding: 20px;
      background: var(--panel);
      box-shadow: var(--shadow);
    }

    .auth-card::before {
      content: "";
      display: block;
      height: 150px;
      margin-bottom: 24px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: var(--bg);
    }

    .auth-tabs {
      height: 42px;
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      align-items: center;
      margin-bottom: 12px;
      border: 1px solid var(--line);
      border-radius: 9px;
      overflow: hidden;
      background: var(--bg);
    }

    .auth-tabs a {
      height: 100%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: var(--text);
      font-size: 13px;
      font-weight: 800;
      text-decoration: none;
    }

    .auth-tabs a.active {
      background: rgba(97, 195, 139, 0.14);
      color: var(--green-dark);
    }

    .auth-field {
      position: relative;
      display: block;
      margin-bottom: 12px;
    }

    .auth-field input {
      width: 100%;
      height: 44px;
      border: 1px solid var(--line);
      border-radius: 9px;
      padding: 0 15px;
      box-sizing: border-box;
      background: var(--bg);
      color: var(--text);
      font: inherit;
      font-size: 14px;
      outline: none;
    }

    .auth-field input::placeholder {
      color: var(--muted);
    }

    .auth-field input:focus {
      border-color: var(--green);
      box-shadow: 0 0 0 2px rgba(97, 195, 139, 0.18);
    }

    .auth-password-field input {
      padding-right: 62px;
    }

    .auth-password-field button {
      position: absolute;
      right: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text);
      font-size: 13px;
      font-weight: 800;
    }

    .auth-checks {
      display: grid;
      gap: 10px;
      margin: 4px 0 44px;
      color: var(--text);
      font-size: 14px;
    }

    .auth-checks label {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      width: fit-content;
    }

    .auth-checks input {
      width: 18px;
      height: 18px;
      margin: 0;
      accent-color: var(--green-dark);
    }

    .auth-message {
      min-height: 18px;
      margin: 0 0 12px;
      color: var(--muted);
      font-size: 13px;
    }

    .auth-message.is-error {
      color: #ff7a7a;
    }

    .auth-primary {
      width: 100%;
      height: 38px;
      border: 0;
      border-radius: 9px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-decoration: none;
      background: var(--green-dark);
      color: #fff;
    }

    .auth-primary.auth-signup-only,
    .auth-primary.auth-forgot-only {
      display: none;
    }

    body[data-auth-mode="signup"] .auth-primary.auth-signup-only,
    body[data-auth-mode="forgot"] .auth-primary.auth-forgot-only {
      display: inline-flex;
    }

    .auth-primary:active {
      transform: scale(.99);
    }

    .auth-card .auth-signup-only,
    .auth-card .auth-forgot-only,
    body[data-auth-mode="login"] .auth-card .auth-signup-only,
    body[data-auth-mode="login"] .auth-card .auth-forgot-only,
    body[data-auth-mode="signup"] .auth-card .auth-login-only,
    body[data-auth-mode="signup"] .auth-card .auth-forgot-only,
    body[data-auth-mode="forgot"] .auth-card .auth-login-only,
    body[data-auth-mode="forgot"] .auth-card .auth-signup-only,
    body[data-auth-mode="forgot"] .auth-card .auth-password-only {
      display: none;
    }

    body[data-auth-mode="signup"] .auth-card .auth-signup-only,
    body[data-auth-mode="forgot"] .auth-card .auth-forgot-only {
      display: block;
    }

    body[data-auth-mode="signup"] .auth-card .auth-primary.auth-signup-only,
    body[data-auth-mode="forgot"] .auth-card .auth-primary.auth-forgot-only {
      display: inline-flex;
    }

    @media (min-width: 900px) {
      .auth-page {
        grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
        gap: clamp(36px, 7vw, 120px);
        align-items: stretch;
        justify-items: center;
        padding: clamp(36px, 6vh, 80px) clamp(36px, 7vw, 120px);
      }

      .auth-page::before {
        content: "";
        display: block;
        width: 100%;
        min-height: 560px;
        border-radius: 28px;
        background: var(--panel);
        box-shadow: var(--shadow);
      }

      .auth-card {
        align-self: center;
        width: min(350px, 100%);
      }
    }

    @media (max-width: 520px) {
      .auth-card::before {
        height: 112px;
        margin-bottom: 18px;
      }
    }

    .app-data-message {
      position: fixed;
      left: 50%;
      bottom: calc(22px + var(--safe-bottom));
      z-index: 1000;
      max-width: min(360px, calc(100vw - 32px));
      padding: 12px 14px;
      border-radius: 14px;
      background: rgba(31, 39, 31, 0.92);
      color: #fff;
      font-size: 13px;
      font-weight: 700;
      opacity: 0;
      pointer-events: none;
      transform: translate(-50%, 12px);
      transition: opacity .18s ease, transform .18s ease;
    }

    .app-data-message.show {
      opacity: 1;
      transform: translate(-50%, 0);
    }

    button {
      border: 0;
      background: none;
      color: inherit;
      font: inherit;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }

    .app-shell {
      width: 100%;
      min-height: 100vh;
      margin: 0 auto;
      background: var(--bg);
      display: flex;
      justify-content: center;
    }

    .phone-frame {
      position: relative;
      width: 100%;
      max-width: 430px;
      min-height: 100vh;
      background: var(--bg);
      overflow: hidden;
    }

    .page {
      height: 100vh;
      display: flex;
      flex-direction: column;
      padding: 16px 16px calc(78px + var(--safe-bottom));
    }

    .segmented-wrap {
      margin-top: 16px;
      padding: 5px;
      border-radius: 999px;
      background: #e9eee5;
      position: relative;
      display: grid;
      grid-template-columns: 1fr 1fr;
    }

    .segmented-indicator {
      position: absolute;
      top: 5px;
      left: 5px;
      width: calc(50% - 5px);
      height: calc(100% - 10px);
      border-radius: 999px;
      background: var(--panel);
      box-shadow: 0 8px 18px rgba(25, 50, 25, .10);
      transition: transform .28s cubic-bezier(.2,.8,.2,1);
      z-index: 0;
    }

    .segmented-wrap.todo-active .segmented-indicator { transform: translateX(100%); }

    .tab-button {
      position: relative;
      z-index: 1;
      min-height: 46px;
      border-radius: 999px;
      font-weight: 900;
      color: var(--muted);
    }

    .tab-button.active { color: var(--text); }

    .routine-tab-button {
      display: grid;
      grid-template-columns: 32px 1fr 32px;
      align-items: center;
      justify-items: center;
      padding: 0 8px;
    }

    .routine-tab-icon {
      width: 28px;
      height: 28px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      background: #f1f3ef;
      color: var(--muted);
      font-size: 18px;
      font-weight: 900;
      line-height: 1;
      cursor: pointer;
    }

    .account-icon {
      color: var(--text);
    }

    .account-icon-shape {
      position: relative;
      display: inline-block;
      width: 20px;
      height: 20px;
    }

    .account-icon-shape::before {
      content: "";
      position: absolute;
      left: 6px;
      top: 2px;
      width: 8px;
      height: 8px;
      border: 2px solid currentColor;
      border-radius: 50%;
      box-sizing: border-box;
    }

    .account-icon-shape::after {
      content: "";
      position: absolute;
      left: 3px;
      bottom: 2px;
      width: 14px;
      height: 9px;
      border: 2px solid currentColor;
      border-radius: 10px 10px 4px 4px;
      box-sizing: border-box;
    }


    .main-panel {
      margin-top: 10px;
      flex: 1;
      min-height: 0;
      border-radius: var(--radius);
      background: var(--panel);
      box-shadow: var(--shadow);
      overflow: hidden;
      position: relative;
    }

    .list-view {
      height: 100%;
      overflow-y: auto;
      padding: 10px 10px 88px;
      scroll-behavior: smooth;
    }

    .routine-list {
      position: relative;
    }

    .task-row {
      min-height: 68px;
      margin-bottom: 10px;
      border-radius: 18px;
      background: #fafbf8;
      border: 1px solid var(--line);
      display: grid;
      grid-template-columns: 2fr 7fr 1fr;
      align-items: center;
      overflow: hidden;
    }

    .task-row[hidden] {
      display: none !important;
    }

    .task-cell {
      min-height: 68px;
      display: flex;
      align-items: center;
      padding: 0 12px;
      border-right: 1px solid var(--line);
    }

    .task-cell:last-child { border-right: 0; justify-content: center; }

    .routine-badge {
      width: 38px;
      height: 38px;
      border-radius: 14px;
      background: #eef1ed;
      color: #60685f;
      display: grid;
      place-items: center;
      font-weight: 900;
    }

    .task-title { font-weight: 900; }
    .task-content-with-streak {
      width: 100%;
      min-width: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-rows: auto auto;
      align-items: center;
      column-gap: 8px;
    }

    .task-content-with-streak .task-title {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .task-content-with-streak .task-sub {
      grid-column: 1 / 2;
      min-width: 0;
    }

    .routine-streak-badge {
      grid-column: 2 / 3;
      grid-row: 1 / 3;
      min-width: 42px;
      min-height: 26px;
      border-radius: 999px;
      background: #eef1ed;
      color: var(--text);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 0 8px;
      font-size: 12px;
      font-weight: 900;
      white-space: nowrap;
    }

    .routine-streak-icon.is-out {
      filter: grayscale(1);
      opacity: .58;
    }

    .task-sub {
      margin-top: 3px;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.35;
    }
    .task-sub span {
      display: block;
    }
    .task-check {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      border: 2px solid var(--gray);
      display: grid;
      place-items: center;
      color: white;
      font-size: 15px;
      font-weight: 900;
      cursor: pointer;
      transition: background .18s ease, border-color .18s ease, transform .18s ease;
    }
    .task-check::after { content: ""; }
    .task-check.checked {
      background: var(--green);
      border-color: var(--green);
    }
    .task-check.checked::after { content: "✓"; }
    .task-check:active { transform: scale(.92); }
    .task-row.routine-group-row {
      background: #fafbf8;
      border-color: #d9e0d4;
      overflow: visible;
      position: relative;
    }

    .task-row.routine-group-row .task-cell {
      min-height: 78px;
      background: transparent;
    }

    .task-row.routine-group-row.has-highlight {
      background: var(--routine-highlight-color);
    }

    .task-row.routine-group-row.has-highlight .task-cell,
    .task-row.routine-group-row.has-highlight .routine-badge,
    .task-row.routine-group-row.has-highlight .routine-group-progress {
      background: transparent;
    }

    .routine-group-toggle {
      position: absolute;
      left: -22px;
      top: 50%;
      transform: translateY(-50%);
      width: 38px;
      height: 38px;
      margin: 0;
      padding: 0;
      border-radius: 12px;
      display: grid;
      place-items: center;
      color: #485047;
      font-size: 22px;
      font-weight: 900;
      z-index: 5;
      pointer-events: auto;
    }

    .routine-group-progress {
      min-width: 42px;
      display: grid;
      place-items: center;
      gap: 3px;
      color: #4d564d;
      font-weight: 900;
      line-height: 1.1;
    }

    .routine-group-progress-icon {
      font-size: 22px;
    }

    .routine-group-progress-count {
      font-size: 15px;
    }

    .task-row.routine-group-child {
      margin-top: -10px;
      margin-left: 22px;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
      border-color: #dfe6db;
      background: #fffefa;
      position: relative;
    }

    .task-row.routine-group-child::before {
      content: "";
      position: absolute;
      left: -14px;
      top: -1px;
      bottom: -1px;
      width: 2px;
      background: #dfe6db;
    }

    .task-row.routine-group-child .routine-badge {
      background: transparent;
      color: #527252;
    }

    .task-row.is-resting {
      background: #f3f8fc;
      border-color: rgba(90, 167, 232, .28);
      color: #7b8790;
    }
    .task-row.is-resting .routine-badge {
      background: #e4f1fb;
      color: #397eaf;
    }
    .task-row.is-resting .task-title,
    .task-row.is-resting .task-sub {
      opacity: .58;
    }
    .task-row.is-resting .task-cell:last-child {
      background: rgba(90, 167, 232, .08);
    }
    .task-check.disabled {
      background: #edf1f5;
      border-color: rgba(90, 167, 232, .38);
      color: var(--muted);
      cursor: not-allowed;
      opacity: .8;
      position: relative;
    }
    .task-check.disabled::before {
      content: "";
      width: 12px;
      height: 2px;
      border-radius: 999px;
      background: #7fa9c8;
      transform: rotate(-35deg);
    }
    .task-check.disabled.checked::after { content: ""; }


    .todo-list { display: none; }
    .show-todo .routine-list { display: none; }
    .show-todo .todo-list { display: block; }
    .show-todo .routine-only { display: none; }

    .fab {
      position: absolute;
      right: 22px;
      bottom: calc(94px + var(--safe-bottom));
      width: 60px;
      height: 60px;
      border-radius: 50%;
      background: var(--green);
      color: white;
      box-shadow: 0 14px 30px rgba(35, 148, 86, .35);
      display: grid;
      place-items: center;
      font-size: 38px;
      font-weight: 300;
      z-index: 4;
    }

    .add-menu {
      position: absolute;
      right: 22px;
      bottom: calc(162px + var(--safe-bottom));
      width: 168px;
      border-radius: 20px;
      padding: 8px;
      background: var(--panel);
      box-shadow: var(--shadow);
      display: none;
      z-index: 5;
    }

    .add-menu.open { display: block; }
    .add-menu button {
      width: 100%;
      min-height: 44px;
      border-radius: 14px;
      text-align: left;
      padding: 0 12px;
      font-weight: 800;
    }
    .add-menu button:hover { background: #f1f5ee; }

    .bottom-nav {
      position: absolute;
      left: 16px;
      right: 16px;
      bottom: calc(12px + var(--safe-bottom));
      height: 64px;
      border-radius: 24px;
      background: rgba(255,255,255,.94);
      box-shadow: var(--shadow);
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      padding: 7px;
      z-index: 10;
      backdrop-filter: blur(16px);
    }

    .nav-button {
      border-radius: 18px;
      font-weight: 900;
      color: var(--muted);
    }
    .nav-button.active { background: #e8f7ee; color: var(--green-dark); }
    .show-order .bottom-nav,
    .show-order .fab,
    .show-order .add-menu {
      display: none;
    }

    .show-stats .fab,
    .show-stats .add-menu {
      display: none;
    }


    @media (min-width: 768px) {
      .app-shell {
        align-items: center;
        padding: 32px;
        background: linear-gradient(135deg, #eef5ed, #f8faf5);
      }
      .phone-frame {
        max-width: 430px;
        min-height: 860px;
        height: min(860px, calc(100vh - 64px));
        border-radius: 38px;
        box-shadow: 0 26px 80px rgba(35, 60, 45, .18);
      }
      .page,
      .week-page,
      .order-page { height: 100%; }
    }

    @media (max-width: 360px) {
      .page { padding-left: 12px; padding-right: 12px; }
      .month-button { padding-inline: 12px; font-size: 14px; }
      .icon-button { width: 38px; height: 38px; }
      .week-strip { gap: 5px; }
      .date-dot { width: 28px; height: 28px; }
      .calendar-title { min-width: 104px; font-size: 15px; }
      .calendar-today { padding-inline: 10px; }
    }

