/* App navigation and responsive editing surfaces. */
.day-marks{display:contents}
.agenda-head,.sheet-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.agenda-head .light{display:inline-flex;gap:4px;align-items:center;white-space:nowrap}
.agenda-head svg{width:15px;height:15px}
.sheet-heading h2{margin:0}
.day-timing{display:grid;gap:14px;min-width:0}
.timer-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,.55fr);gap:8px}
.timer-fields input,.timer-fields select{display:block;margin-top:5px}
.time-details label{display:block;margin:9px 0 5px;font-size:13px}
.time-details .time-history h2{font-size:14px}
.mobile-notebooks,.mobile-new-label{display:none}
#mobile-notebook-list{display:grid;margin:10px 0}
.mobile-book-row{display:flex;align-items:center;gap:10px;width:100%;padding:11px 8px;text-align:left;border-bottom:1px solid var(--line)}
.mobile-book-row span:nth-child(2){flex:1;overflow-wrap:anywhere}
.mobile-book-row[aria-current=true]{color:var(--dark-green);background:#eff8f1}
.mobile-create-book{width:100%;margin-top:8px}

@media (max-width:760px), (pointer:coarse) and (max-width:960px){
  :root{--mobile-bg:#f3f6f3;--mobile-border:#e3eae4;--mobile-green:#00864a;--mobile-ink:#1b3025;--mobile-tab:calc(60px + env(safe-area-inset-bottom,0px))}
  html,body{overscroll-behavior:none;background:var(--mobile-bg)}
  body{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;-webkit-tap-highlight-color:transparent}
  button,a,input,select,textarea{touch-action:manipulation}
  button,.light,.primary,.icon-button{min-height:44px}
  input,textarea,select{font-size:16px!important}
  .workspace,.workspace:not([data-view=notes]){height:var(--app-height,100dvh);grid-template-rows:minmax(0,1fr) var(--mobile-tab)}
  .workspace.editing[data-view=notes],.workspace[data-keyboard-open]{grid-template-rows:minmax(0,1fr)}
  .workspace.editing[data-view=notes] .sidebar,.workspace[data-keyboard-open] .sidebar{display:none}
  .note-list,.main,.board{background:var(--mobile-bg)}
  .workspace{position:fixed;inset:0 0 auto}
  .workspace.editing[data-view=notes]{top:var(--visual-top,0px)}
  .sidebar{background:#fff;padding:4px max(8px,env(safe-area-inset-left)) env(safe-area-inset-bottom) max(8px,env(safe-area-inset-right));border-top:1px solid var(--mobile-border);box-shadow:0 -4px 16px #1633220b}
  .nav{gap:3px;align-items:center}
  .nav button{flex:1;min-width:0;min-height:50px;gap:2px;padding:3px 2px;border-radius:12px;color:#617267;font-size:11px;letter-spacing:.02em}
  .nav button [data-icon]{display:grid;place-items:center;height:26px;width:44px;border-radius:14px}
  .nav button svg{width:22px;height:22px}
  .nav button[aria-current=page]{background:transparent;color:#007742;font-weight:700}
  .nav button[aria-current=page] [data-icon]{background:#dff2e5}
  .note-list{overflow:hidden}
  .list-head{flex:none;padding:max(12px,env(safe-area-inset-top)) 16px 7px;margin-bottom:7px}
  .list-title{margin-bottom:12px;gap:6px}
  .list-title h1,.board-head h1{font-size:31px;line-height:1.15;color:var(--mobile-ink);letter-spacing:-.02em}
  .list-actions{align-items:center;gap:4px;flex:none}
  .list-actions .mobile-new,.mobile-new-label{display:inline-flex}
  .list-actions .mobile-new{width:auto;padding:0 11px;gap:3px;font-size:13px;font-weight:700}
  .search{height:45px;border-radius:13px;background:#e8eee9;border-color:transparent;gap:8px;padding-inline:12px}
  .search svg{width:18px;height:18px}
  .note-list-meta{display:flex;align-items:center;justify-content:space-between;gap:5px;margin-top:6px}
  .mobile-notebooks{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:72%;background:transparent;color:var(--mobile-green);padding:0 3px;font-weight:650}
  .mobile-notebooks svg{width:15px;height:15px}
  #mobile-notebook-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .note-list-count{font-size:12px}
  #note-summary{color:#607267}
  .note-sort select{min-height:44px;font-size:inherit!important}
  #notes{min-height:0;padding:0 16px 16px;overscroll-behavior-y:contain}
  .note-row{grid-template-columns:minmax(0,1fr) 44px;padding-right:5px;background:#fff;border-bottom:1px solid #edf1ed}
  .note-row:first-child{border-radius:14px 14px 0 0}
  .note-row:last-child{border-radius:0 0 14px 14px}
  .note-row:only-child{border-radius:14px}
  .note-row .delete{opacity:1;width:44px;color:#6b756e}
  .note-row .delete svg{width:18px;height:18px}
  .note-select{min-height:85px;padding:12px 8px 12px 13px;gap:5px}
  .note-select strong{font-size:16px;color:#233b2f}
  .note-select p{font-size:13px}
  .list-empty{background:#fff;border-radius:13px;margin-top:5px;padding:19px 14px;font-size:14px}
  .list-actions .mobile-new,.board-actions-head>.primary{background:transparent;color:#007742}
  .list-actions .mobile-new:is(:hover,:active),
  .board-actions-head>.primary:is(:hover,:active){background:transparent;color:#005c32}
  .notes-panel{min-height:0}
  .workspace.editing .notes-panel{padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
  .workspace.editing[data-keyboard-open] .notes-panel{padding-bottom:0}
  .board{--board-gutter:15px;padding:0;overflow:hidden}
  .board,#calendar-overview,#day-page{display:flex;flex-direction:column;min-height:0}
  #calendar-overview,#day-page{flex:1}
  .board-content{
    flex:1;min-height:0;overflow:auto;overscroll-behavior-y:contain;
    padding:0 var(--board-gutter) 26px;scroll-padding:12px;
  }
  .board-head,.day-page-head{
    margin:0 0 12px;
    padding:max(10px,env(safe-area-inset-top)) max(15px,env(safe-area-inset-right)) 9px max(15px,env(safe-area-inset-left));
  }
  .list-head,.board-head:not(.day-head),.day-page-head{
    flex:none;
    background:#f3f6f3;border-bottom:1px solid #dfe9e2;
  }
  @supports ((backdrop-filter:blur(12px)) or (-webkit-backdrop-filter:blur(12px))){
    .list-head,.board-head:not(.day-head),.day-page-head{
      background:rgb(243 246 243 / .82);
      -webkit-backdrop-filter:blur(12px) saturate(1.2);
      backdrop-filter:blur(12px) saturate(1.2);
    }
  }
  .board-head p{font-size:13px;line-height:1.4}
  .board-actions-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 6px}
  .board-actions-head>div:first-child{display:contents}
  .board-actions-head .mobile-title-row{grid-area:1/1}
  .board-actions-head>:last-child{grid-area:1/2}
  .board-actions-head>.primary{padding:0 11px;gap:3px;font-size:13px;font-weight:700}
  .board-actions-head p{grid-area:2/1/3/-1;margin:0}
  .primary{background:#00864a;border-radius:13px;padding-inline:12px}
  .primary:active{background:#006f3b}
  .light,.icon-button{border-radius:11px}
  .task-toolbar{flex-wrap:wrap;gap:8px;border:0;align-items:stretch;margin-bottom:13px}
  .task-toolbar .filters,.task-views,.stats-periods{background:#e8eee9;border:0;border-radius:12px;padding:3px;gap:3px;display:flex}
  .task-toolbar .filters{flex:1 1 auto}
  .task-views{flex:0 0 auto;margin-left:auto}
  .task-toolbar .filters button,.task-views button,.stats-periods button{border:0;padding:5px 8px;min-height:40px;border-radius:9px;white-space:nowrap;font-size:12px}
  .task-toolbar .filters button{flex:1}
  .task-toolbar .filters button[aria-pressed=true],.task-views button[aria-pressed=true],.stats-periods button[aria-pressed=true]{background:#fff;color:#007642;box-shadow:0 1px 3px #193e2420}
  .task-card{background:#fff;border:1px solid var(--mobile-border);border-radius:14px;margin:0 0 9px;padding:5px 11px 12px}
  .task-card .task{min-height:50px;gap:10px}
  .task-check{min-width:44px;min-height:44px;display:grid;place-items:center;flex:none}
  .task-check input{width:20px;height:20px;margin:0}
  .task .item-label{font-size:15px;font-weight:650;min-height:44px}
  .task .task-dates{max-width:39%;padding-left:3px}
  .task .task-dates time{font-size:11px}
  .task-progress{padding-left:4px}
  .task-progress-meter{height:7px}
  .milestone-button{min-height:48px;background:#f0f7f1}
  .gantt-scroll{background:#fff;border-radius:13px;margin-top:6px}
  .gantt-grid{grid-template-columns:128px minmax(0,1fr)}
  .gantt-name,.gantt-column{position:sticky;left:0;background:#fff;z-index:2;font-size:14px}
  .gantt-scroll,.milestone-strip,.stats-trend-scroll{overscroll-behavior-inline:contain}
  .board .calendar-toolbar{padding:0 6px}
  .calendar-toolbar,.calendar-toolbar>div{gap:3px}
  .calendar-toolbar h2{font-size:19px;color:var(--mobile-ink)}
  .calendar-toolbar .icon-button{width:44px}
  .calendar-grid{border:1px solid var(--mobile-border);border-radius:14px;overflow:hidden;background:#fff}
  .day{min-height:76px;display:flex;align-items:center;justify-content:flex-start;gap:3px;border-width:0;padding:2px;font-size:14px;border-radius:10px}
  .day .date{min-width:24px;height:24px;flex:none}
  .calendar-day-metrics{gap:1px}
  .calendar-day-metric{font-size:10px;line-height:12px;gap:2px}
  .calendar-day-metric svg{width:10px;height:10px}
  .day.outside{background:none;color:#89998e}
  .day.selected{background:#e6f3e9}
  .day-marks{display:flex;gap:3px;min-height:6px}
  .day-marks .event-chip{width:5px;height:5px;min-width:5px;padding:0;font-size:0;border-radius:50%;background:#00864a}
  .day-marks .task-chip{background:#8b7350}
  .day-marks .event-chip:last-child:not(.task-chip){background:#00864a}
  .weekdays{font-size:12px}
  .agenda,.day-card,.stats-card{border:1px solid var(--mobile-border);border-radius:15px;background:#fff}
  .agenda{padding:10px 11px;margin-top:13px}
  .agenda-head .light{white-space:nowrap;color:#007642;background:#e9f4ec}
  .agenda-item{min-height:47px}
  .day-page-head{display:flex;align-items:center;gap:6px}
  .day-page-head .day-back{flex:none;margin:0;color:#007642;padding-inline:6px;background:transparent}
  .day-page-head .day-head{min-width:0;margin:0;padding:0}
  .day-head h1{font-size:clamp(17px,5vw,25px)}
  .day-dashboard{grid-template-columns:minmax(0,1fr);gap:12px}
  .day-timing{display:contents}
  .overtime-card{order:-2}
  .timer-card{order:-1}
  .day-activity{gap:10px}
  .timer-fields{gap:9px}
  .timer-card input,.timer-card select,.time-details select{height:46px;border-radius:11px}
  .day-card h2,.time-details .time-history h2{font-size:17px}
  .timer-readout{padding:15px 0;font:650 clamp(38px,12vw,56px)/1.15 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;letter-spacing:.025em;color:#1f4835}
  .timer-actions{gap:8px}
  .timer-actions .primary,.timer-actions .light{flex:1;font-size:15px}
  .timer-actions .primary{min-height:49px}
  .day-activity-row,.timer-record{min-height:49px}
  .timer-record-actions>.icon-button{min-width:44px;min-height:44px}
  .day-activity-row strong,.timer-record .record-name{font-size:14px}
  .overtime-more{min-height:44px}
  .stats-head h1 svg{display:none}
  .stats-periods{flex:none}
  .stats-periods button{min-width:38px;padding-inline:9px}
  .stats-range{margin-bottom:12px;flex-wrap:wrap}
  .stats-range h2{font-size:15px}
  .stats-range .icon-button{min-width:40px}
  .stats-range .light{padding-inline:8px}
  .stats-date-picker{min-height:44px}
  .stats-kpis{grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
  .stats-kpi{grid-column:span 2;grid-template-columns:minmax(0,1fr);align-content:start;gap:5px;padding:10px 8px;border-radius:13px}
  .stats-kpi[data-metric=overtime],.stats-kpi[data-metric=overtime-count]{grid-column:span 3;grid-template-columns:auto minmax(0,1fr)}
  .stats-kpi-icon{width:29px;height:29px;border-radius:9px}
  .stats-kpi-icon svg{width:17px;height:17px}
  .stats-kpi strong,#stats-time-total strong{font:650 22px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
  .stats-kpi[data-metric=overtime] strong{font-size:clamp(15px,5vw,24px)}
  .stats-charts{grid-template-columns:minmax(0,1fr);gap:10px}
  .stats-trend-plot{min-width:max(var(--plot-min),calc(var(--buckets) * 31px))}
  dialog.mobile-sheet{position:fixed;inset:auto 0 var(--keyboard-offset,0px);margin:0;width:100%;max-width:none;max-height:calc(var(--app-height,100dvh) - 15px);border:0;border-radius:21px 21px 0 0;padding:18px 16px max(14px,env(safe-area-inset-bottom));overflow:auto;overscroll-behavior:contain}
  dialog.mobile-sheet[open]{animation:mobile-sheet-in .18s ease-out both}
  dialog#note-input-dialog{
    top:calc(var(--visual-top,0px) + max(12px,env(safe-area-inset-top)));
    bottom:auto;inset-inline:12px;width:calc(100% - 24px);
    border-radius:16px;animation:none;
  }
  dialog#note-input-dialog::before{display:none}
  dialog#note-input-dialog label{margin-top:0;font-weight:650}
  dialog.mobile-sheet::backdrop{background:#0f251e66}
  dialog.mobile-sheet::before{content:"";display:block;width:34px;height:4px;border-radius:5px;background:#c8d6cb;margin:-8px auto 10px}
  dialog.mobile-sheet h2{font-size:21px;color:var(--mobile-ink);outline:0}
  dialog.mobile-sheet input,dialog.mobile-sheet textarea{min-height:46px;width:100%;border-radius:10px}
  dialog.mobile-sheet :is(textarea,input:not([type]),input:is([type=text],[type=search],[type=password],[type=number],[type=email],[type=tel],[type=url])){touch-action:pan-x}
  #item-dialog textarea{resize:none;overscroll-behavior-y:contain}
  .workspace[data-keyboard-open] ~ #item-dialog{
    top:calc(var(--visual-top,0px) + 8px);bottom:auto;
    height:calc(var(--app-height,100dvh) - 16px);max-height:none;
  }
  #item-dialog[data-status-editing][open]{
    top:calc(var(--visual-top,0px) + max(8px,env(safe-area-inset-top)));bottom:auto;
    height:auto;max-height:calc(var(--app-height,100dvh) - max(8px,env(safe-area-inset-top)) - 8px);
    padding:12px 16px;overflow:hidden;overscroll-behavior:none;touch-action:none;animation:none;
  }
  #item-dialog[data-status-editing]::before,
  #item-dialog[data-status-editing] form>label,
  #item-dialog[data-status-editing] #task-fields>:not(.task-status-field):not(.status-controls),
  #item-dialog[data-status-editing] :is(.status-controls p,#delete-item,[data-action=close-dialog]){display:none}
  #item-dialog[data-status-editing] h2{margin-bottom:8px}
  #item-dialog[data-status-editing] .task-status-field{margin-top:0}
  #item-dialog[data-status-editing] textarea{height:clamp(50px,calc(var(--app-height,100dvh) - 176px),85px)}
  #item-dialog[data-status-editing] .status-controls{justify-content:flex-end}
  #item-dialog[data-status-editing] .dialog-actions{margin-top:6px;padding-block:5px 0}
  html:has(#item-dialog textarea:focus),body:has(#item-dialog textarea:focus){overflow:hidden}
  dialog.mobile-sheet:has(:is(input,textarea):focus){scroll-padding:12px 0 76px}
  .workspace[data-keyboard-open] ~ dialog.mobile-sheet{padding-bottom:14px;animation:none}
  dialog.mobile-sheet .dialog-actions{position:sticky;bottom:0;background:#fff;z-index:1;padding:7px 0;border-top:1px solid #edf1ed}
  .item-fields{grid-template-columns:minmax(0,1fr);gap:0}
  .overtime-edit-segment{grid-template-columns:minmax(0,1fr) auto}
  .overtime-edit-segment label{grid-column:1}
  .overtime-edit-segment button{grid-column:2;grid-row:1/3;min-width:44px}
  dialog#cloud-dialog{width:min(390px,calc(100vw - 24px));height:var(--app-height,100dvh);max-height:var(--app-height,100dvh);border-radius:0 20px 20px 0;padding-inline:15px}
  .cloud-drawer-head{margin-bottom:12px}
  .cloud-state{display:inline-block;background:#eaf5ec;color:#145e39;border-radius:8px;padding:7px 9px}
  #cloud-login input{min-height:48px;border-radius:11px}
  .cloud-actions{display:grid;grid-template-columns:1fr 1fr}
  .cloud-backups a{display:flex;align-items:center;min-height:44px}
  #toast{max-width:calc(100vw - 28px);bottom:calc(var(--mobile-tab) + 10px);inset-inline-end:14px;z-index:10}
  .backup-page{padding:max(24px,env(safe-area-inset-top)) 14px}
  .backup-card{padding:16px}
  .backup-actions a{display:flex;align-items:center;min-height:44px}
}
@media(max-width:360px){
  #calendar-panel{--board-gutter:7px}
  .stats-periods button{min-width:34px;padding-inline:7px}
  .stats-kpi small{font-size:10px}
  .task-toolbar .filters button,.task-views button{padding-inline:6px}
  .stats-range .icon-button{min-width:35px}
  .stats-range h2{font-size:13px}
  .stats-range{gap:5px}
  .stats-range-controls{gap:2px}
  .stats-date-picker{padding-inline:3px}
  .note-select{padding-left:10px}
}
@keyframes mobile-sheet-in{from{transform:translateY(25px);opacity:.7}to{transform:none;opacity:1}}
@media(prefers-reduced-motion:reduce){dialog.mobile-sheet[open]{animation:none}}
.task-check{display:inline-flex;align-items:center}
@media (max-width:760px), (pointer:coarse) and (max-width:960px){.task-check{display:grid}}
@media (max-width:760px), (pointer:coarse) and (max-width:960px){
  dialog:is(#item-dialog,#overtime-dialog).mobile-sheet{width:100%;max-height:calc(var(--app-height,100dvh) - 15px)}
}
#confirm-message{font-size:14px;color:var(--muted);line-height:1.55;overflow-wrap:anywhere}
#confirm-accept.confirm-danger{background:#b13b36}
#confirm-accept.confirm-danger:hover{background:#912b27}
.mobile-title-row{display:flex;align-items:center;min-width:0}
.mobile-title-row h1{min-width:0}
.mobile-title-row .mobile-sidebar-toggle{display:none}
@media (max-width:760px), (pointer:coarse) and (max-width:960px){
  .mobile-title-row{gap:3px;min-height:44px}
  .mobile-title-row .mobile-sidebar-toggle{display:inline-flex;flex:none;width:44px;color:#087d48;margin-left:-7px}
  .mobile-title-row .mobile-sidebar-toggle svg{width:20px;height:20px}
  .board-head>div:first-child,.list-title>.mobile-title-row{min-width:0}
  .board-head .mobile-title-row+h1{margin:0}
  dialog#mobile-sidebar-dialog{position:fixed;inset:0 auto 0 0;margin:0;width:min(340px,calc(100vw - 24px));height:var(--app-height,100dvh);max-height:var(--app-height,100dvh);border:0;border-radius:0 20px 20px 0;padding:max(18px,env(safe-area-inset-top)) 15px max(16px,env(safe-area-inset-bottom));background:#fbfdfb;overflow:auto}
  #mobile-sidebar-dialog[open]{animation:cloud-drawer-in .2s ease-out both}
  #mobile-sidebar-dialog[open].closing{animation:cloud-drawer-out .18s ease-in both}
  #mobile-sidebar-dialog::backdrop{background:#172c2280}
  #mobile-sidebar-title img{width:28px;height:28px}
  .mobile-sidebar-menu{display:grid;gap:6px}
  .mobile-sidebar-menu button{display:flex;align-items:center;gap:8px;width:100%;min-height:52px;padding:6px 10px;background:#eff5ef;border-radius:12px;text-align:left;color:#254b36;font-weight:600}
  .mobile-sidebar-menu button>span:nth-child(2){flex:1}
  .mobile-sidebar-menu button [data-icon]{color:#087d48}
  .mobile-sidebar-menu .cloud-entry-state{font-weight:400;white-space:nowrap}
  .mobile-sidebar-menu button:active{background:#e0eee2}
}
@media(prefers-reduced-motion:reduce){#mobile-sidebar-dialog[open],#mobile-sidebar-dialog[open].closing{animation:none}}
@media (max-width:760px), (pointer:coarse) and (max-width:960px){
  #mobile-sidebar-dialog[open]{display:flex;flex-direction:column}
  #mobile-sidebar-dialog .mobile-connection{flex:none;padding:10px 0 0;border-top:1px solid var(--line);margin-top:auto}
  .mobile-connection .sync-settings{min-width:44px;min-height:44px}
}
