:root{
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif;
  color:#302927;
  background:#f5f0eb;
  --bg:#f5f0eb;
  --paper:#fffdf9;
  --paper-2:#fbf6f1;
  --ink:#302927;
  --muted:#857a74;
  --line:#e9dfd8;
  --accent:#b98779;
  --accent-dark:#97695d;
  --accent-soft:#ead6ce;
  --olive:#78806b;
  --shadow:0 10px 32px rgba(85,64,52,.08);
}
*{box-sizing:border-box}
html{width:100%;min-height:100%;overflow-x:hidden;-webkit-text-size-adjust:100%;text-size-adjust:100%;background:var(--bg)}
body{margin:0;width:100%;min-height:100%;min-height:100dvh;overflow-x:hidden;background:linear-gradient(180deg,#f7f2ee 0%,#f4efe9 100%);overscroll-behavior-x:none;-webkit-tap-highlight-color:transparent}
button,input,select,textarea{font:inherit;color:inherit;touch-action:manipulation}
button{cursor:pointer}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid rgba(185,135,121,.45);outline-offset:1px}
.app-shell{width:min(760px,100%);margin:0 auto;padding:calc(10px + env(safe-area-inset-top)) 12px calc(94px + env(safe-area-inset-bottom))}
.app-header{height:58px;display:flex;align-items:center;justify-content:space-between;padding:2px 3px 8px}
.brand-button{border:0;background:transparent;padding:0;display:flex;align-items:center;gap:10px;min-width:0}
.brand-button img{width:42px;height:42px;border-radius:12px;box-shadow:0 3px 10px rgba(113,84,67,.12)}
.brand-button span{font-family:Georgia,"Times New Roman",serif;font-size:25px;line-height:1;letter-spacing:-.025em;color:#50433e;white-space:nowrap}
.header-right{display:flex;align-items:center;gap:7px}.sync-dot{font-size:11px;color:var(--muted);white-space:nowrap}
.icon-button,.strip-arrow{border:0;background:transparent;display:grid;place-items:center;padding:8px;color:#70655f}
.icon-button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round}
.date-strip{height:46px;border:1px solid var(--line);background:rgba(255,253,249,.72);border-radius:15px;display:grid;grid-template-columns:44px 1fr 44px;align-items:center;margin:2px 0 12px;box-shadow:0 1px 0 rgba(255,255,255,.7) inset}
.strip-arrow svg,.date-main svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.date-main{height:100%;border:0;background:transparent;display:flex;align-items:center;justify-content:center;gap:11px;font-size:14px;font-weight:650;color:#4c433f;min-width:0;position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent}.date-main span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.date-main svg{color:#887d76;pointer-events:none}.date-native{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;border:0;padding:0;margin:0;-webkit-appearance:none;appearance:none}
.content{width:100%;min-width:0}
.label{font-size:10px;font-weight:750;letter-spacing:.11em;color:#81766f}
.sheet{width:100%;min-width:0;background:var(--paper);border:1px solid var(--line);border-radius:18px;overflow:hidden;box-shadow:var(--shadow)}
.sheet-head,.sheet-row{display:grid;width:100%;min-width:0;grid-template-columns:minmax(0,45%) minmax(0,19%) minmax(0,36%)}
.sheet-head{height:35px;align-items:end;padding:0 8px 8px;background:linear-gradient(180deg,#fffefa,#fcf8f4)}
.sheet-head>div{min-width:0}.sheet-head .time-head{padding-left:10px}
.sheet-row{min-height:62px;border-top:1px solid var(--line);align-items:stretch;background:rgba(255,255,255,.48)}
.plan-cell,.time-cell,.reality-cell{min-width:0;overflow:hidden}
.plan-cell{padding-right:13px;position:relative}.plan-cell:after{content:"";position:absolute;right:5px;top:11px;bottom:11px;width:1px;background:rgba(233,223,216,.55)}
.time-cell{display:flex;align-items:center;padding:4px 3px 4px 7px}
.reality-cell{display:grid;grid-template-rows:minmax(34px,1fr) 24px;align-items:stretch;padding:2px 6px 3px 1px;gap:0}
.line-input{display:block;width:100%;min-width:0;height:100%;min-height:60px;max-height:72px;border:0;outline:0;resize:none;overflow:hidden;background:transparent;font-size:15px;line-height:1.25;padding:12px 7px;color:var(--ink);border-radius:0}
.reality-cell .line-input{min-height:34px;max-height:38px;padding:9px 5px 3px;font-size:14px}
.line-input::placeholder{color:#c2b8b1}
.time-btn{width:100%;min-width:0;border:0;background:transparent;text-align:center;padding:7px 1px;font-size:11.5px;font-weight:650;color:#544a45;line-height:1.35;white-space:normal}
.time-btn.blank{color:#b1a7a1;font-weight:500}
.cat-mini{display:block;width:100%;min-width:0;height:23px;border:0;background:#f2ece7;border-radius:7px;padding:2px 20px 2px 6px;font-size:10px;color:#756a64;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.add-row{display:block;width:100%;border:0;border-top:1px solid var(--line);background:#fcf8f4;color:#8e7f77;padding:12px 11px;font-size:14px;text-align:left}
.bottom-nav{position:fixed;z-index:30;left:0;right:0;bottom:0;height:calc(70px + env(safe-area-inset-bottom));padding:7px max(12px,env(safe-area-inset-left)) env(safe-area-inset-bottom) max(12px,env(safe-area-inset-right));background:rgba(255,253,249,.94);border-top:1px solid rgba(222,210,202,.9);display:grid;grid-template-columns:repeat(4,1fr);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
.bottom-nav button{border:0;background:transparent;color:#91857e;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:10px;padding:3px 0;position:relative}
.bottom-nav button svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.bottom-nav button.active{color:var(--accent-dark);font-weight:650}.bottom-nav button.active:after{content:"";position:absolute;top:-8px;width:36px;height:2px;border-radius:99px;background:var(--accent)}
.section-title{padding:8px 3px 2px}.section-title h2{font-family:Georgia,"Times New Roman",serif;font-size:26px;font-weight:500;margin:0;color:#50433e}.section-title p{margin:4px 0 14px;color:var(--muted);font-size:13px}
.card{background:var(--paper);border:1px solid var(--line);border-radius:17px;padding:15px;margin:10px 0;box-shadow:0 3px 12px rgba(85,64,52,.035)}
.history-list{display:grid;gap:9px}.history-card{width:100%;border:1px solid var(--line);background:var(--paper);border-radius:16px;padding:14px 15px;display:flex;justify-content:space-between;align-items:center;text-align:left;box-shadow:0 3px 12px rgba(85,64,52,.035)}.history-card div{display:grid;gap:4px}.history-card b{font-size:14px}.history-card span{font-size:12px;color:var(--muted)}.history-card svg{width:18px;height:18px;fill:none;stroke:#a89990;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.seg{display:flex;background:#eee6e0;padding:3px;border-radius:13px;margin:7px 0 14px}.seg button{flex:1;border:0;background:transparent;padding:8px;border-radius:10px;color:#72655f}.seg .active{background:#fffaf6;color:#5a4942;font-weight:650;box-shadow:0 1px 4px rgba(80,60,50,.08)}
.report-row,.task-row{display:flex;justify-content:space-between;gap:12px;align-items:center}.report-row strong{font-size:13px;color:var(--accent-dark)}.bar{height:7px;background:#eee6e0;border-radius:99px;overflow:hidden;margin-top:9px}.bar span{display:block;height:100%;background:linear-gradient(90deg,#c69b8e,#b98779);border-radius:99px}.task-card{margin-top:16px}.task-row{padding-top:11px;font-size:13px}.task-row b{color:#675a54}.empty{text-align:center;color:var(--muted);padding:40px 12px;font-size:14px}
.settings-card{display:grid;grid-template-columns:38px 1fr;column-gap:11px;align-items:start}.settings-card>button{grid-column:1/-1;margin-top:10px}.settings-card p{margin:4px 0 0;color:var(--muted);font-size:12px;line-height:1.4}.settings-icon{width:36px;height:36px;border-radius:10px;background:#f2e5df;display:grid;place-items:center;color:var(--accent-dark)}.settings-icon svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.version{text-align:center;color:#a39790;font-size:11px;padding:14px}
.btn,.primary,.secondary,.danger{border:0;border-radius:12px;padding:11px 14px;font:inherit}.btn{background:#5d514b;color:#fff}.btn.accent,.primary{background:linear-gradient(180deg,#bd8e80,#ae786b);color:#fff}.btn.ghost,.secondary{background:#f0eae5;color:#5c504a}.danger{background:#fff0f0;color:#8b1e1e}
.modal-back{position:fixed;z-index:60;inset:0;height:100vh;height:100dvh;background:rgba(54,43,37,.32);display:flex;align-items:flex-end;justify-content:center;padding:0;touch-action:none}.modal{width:min(520px,100%);max-height:calc(100dvh - max(16px,env(safe-area-inset-top)));overflow-y:auto;-webkit-overflow-scrolling:touch;background:#fffaf6;border-radius:24px 24px 0 0;padding:8px 16px calc(18px + env(safe-area-inset-bottom));box-shadow:0 -12px 40px rgba(58,44,36,.18)}.modal-handle{width:38px;height:4px;border-radius:99px;background:#d8ccc4;margin:2px auto 13px}.modal-title-row{display:flex;align-items:center;justify-content:space-between}.modal h2{font-family:Georgia,"Times New Roman",serif;font-size:22px;font-weight:500;margin:0 0 14px}.modal-close{border:0;background:#efe7e1;width:34px;height:34px;border-radius:99px;font-size:24px;line-height:1;color:#75675f}.time-group{margin:0 0 13px}.time-group label{display:block;font-size:12px;color:#7a6e68;margin:0 0 6px}.native-time{display:block;width:100%;min-height:54px;border:1px solid #dfd4cd;border-radius:13px;background:#fff;padding:12px 13px;font-size:20px;color:#332b28;box-sizing:border-box;-webkit-appearance:none;appearance:none}.modal-actions{display:flex;gap:9px;margin-top:4px}.modal-actions button{flex:1}.menu-sheet{padding-bottom:calc(10px + env(safe-area-inset-bottom))}.menu-item{width:100%;border:0;border-top:1px solid var(--line);background:transparent;padding:15px 6px;display:flex;align-items:center;gap:12px;text-align:left}.menu-item:first-of-type{border-top:0}.menu-item svg{width:21px;height:21px;fill:none;stroke:var(--accent-dark);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.auth-wrap{min-height:100vh;min-height:100dvh;display:grid;place-items:center;padding:24px}.auth-card{width:min(430px,100%);background:#fffaf6;border:1px solid var(--line);border-radius:22px;padding:24px;box-shadow:var(--shadow)}.auth-brand{display:flex;align-items:center;gap:11px;margin-bottom:20px}.auth-brand img{width:48px;height:48px;border-radius:13px}.brand-title{font-family:Georgia,"Times New Roman",serif;font-size:22px;color:#50433e}.brand-sub{font-size:11px;color:var(--muted);margin-top:2px}.auth-card h1{margin:0 0 8px;font-size:23px}.auth-card p{color:#71655f;line-height:1.45;font-size:14px}.auth-card label{display:block;font-size:12px;margin:14px 0 6px;color:#71655f}.auth-card input,.auth-card select{width:100%;box-sizing:border-box;padding:12px;border:1px solid #ded3cc;border-radius:11px;background:#fff;font:inherit;font-size:16px}.auth-card details{margin:14px 0}.auth-card summary{cursor:pointer;color:#655a54;font-size:13px}.primary{width:100%;margin-top:16px}.small-note{font-size:11px;color:#8a7d76;line-height:1.4}.error{color:#9b1c1c;margin-top:10px;font-size:13px}.file-input{display:none}
@media(max-width:430px){
  .app-shell{padding-left:8px;padding-right:8px}
  .brand-button img{width:39px;height:39px;border-radius:11px}.brand-button span{font-size:23px}.sync-dot{display:none}
  .sheet-head,.sheet-row{grid-template-columns:minmax(0,44%) minmax(0,19%) minmax(0,37%)}
  .sheet-head{padding-left:7px;padding-right:5px}.sheet-head .time-head{padding-left:7px}
  .plan-cell{padding-right:9px}.plan-cell:after{right:3px}.time-cell{padding-left:3px;padding-right:1px}
  .line-input{font-size:14px;padding-left:7px;padding-right:4px}.reality-cell .line-input{font-size:13px;padding-left:4px;padding-right:3px}
  .time-btn{font-size:10.5px}.cat-mini{font-size:10px;padding-left:5px;padding-right:17px}
}
@media(max-width:360px){.brand-button span{font-size:21px}.sheet-head,.sheet-row{grid-template-columns:minmax(0,43%) minmax(0,20%) minmax(0,37%)}.label{font-size:9px;letter-spacing:.08em}.time-btn{font-size:10px}}
@media(display-mode:standalone){body{padding-top:0}.app-shell{padding-top:calc(7px + env(safe-area-inset-top))}}

/* v7 persistence status */
.save-error-banner{
  position:fixed;left:12px;right:12px;bottom:calc(82px + env(safe-area-inset-bottom));z-index:9999;
  display:flex;align-items:center;gap:10px;padding:11px 12px;border:1px solid rgba(145,77,65,.22);
  border-radius:14px;background:#fff8f5;box-shadow:0 8px 30px rgba(55,35,30,.14);font-size:13px;color:#6f4036;
}
.save-error-banner span{flex:1;min-width:0}
.save-error-banner button{border:0;border-radius:10px;padding:8px 12px;background:#b78376;color:white;font-weight:700}
.sync-dot[data-state="error"]{color:#9a4e40;font-weight:700}
.sync-dot[data-state="saving"]{color:#8a766e}

/* v9 category management */
.category-manager{padding:16px}
.category-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.category-head b{font-size:15px;color:#51453f}.category-head p{margin:4px 0 0;color:var(--muted);font-size:12px;line-height:1.4}
.category-head>span{min-width:28px;height:28px;padding:0 8px;border-radius:999px;background:#f2e5df;color:var(--accent-dark);display:grid;place-items:center;font-size:12px;font-weight:750}
.category-list{display:grid;gap:8px}
.category-row{display:grid;grid-template-columns:minmax(0,1fr) 38px;gap:8px;align-items:center}
.category-row input,.category-add input{width:100%;min-width:0;height:43px;border:1px solid #dfd4cd;border-radius:11px;background:#fffefa;padding:9px 11px;font-size:16px;color:var(--ink);appearance:none;-webkit-appearance:none}
.category-delete{width:38px;height:38px;border:0;border-radius:11px;background:#f4ebe7;color:#9a6257;font-size:24px;line-height:1;display:grid;place-items:center}
.category-add{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin-top:12px}
.category-add .btn{min-width:70px;padding-left:15px;padding-right:15px}
.category-note{margin:11px 1px 0;color:#8b7f78;font-size:11px;line-height:1.45}
