/* Web layout — tablet and desktop. Loaded after the app's inline styles.
   Narrow (<600px) is untouched: every rule here sits inside a min-width query,
   except the injected web-only elements, which stay hidden on phones.
   Colours come from the theme-aware app variables (--surface*, --text*,
   --accent*), which resolve to style-kit 2.1.0 tokens per theme. */

.web-brand, .web-keys, .web-title { display:none; }
.web-ghost { display:none; }
.tools-card { padding:16px; margin:12px 0; background:var(--surface); border:1px solid var(--surface2); border-radius:12px; }
.tools-card label { display:block; margin-block:10px; font-size:14px; }
.tools-card input:not([type=checkbox]), .tools-card select { width:100%; max-width:100%; min-height:44px; padding:8px; border:1px solid var(--surface3); border-radius:8px; background:var(--bg); color:var(--text); font:inherit; }
.tools-card fieldset { display:flex; flex-wrap:wrap; gap:12px; border:1px solid var(--surface3); padding:8px; }
.tools-card fieldset label { min-height:44px; display:flex; align-items:center; }
.tools-time { display:block; font:300 40px/1.4 ui-monospace,monospace; font-variant-numeric:tabular-nums; }
.tools-fields, .tools-controls, .tools-nav { display:flex; gap:8px; flex-wrap:wrap; }
.tools-fields label { flex:1; min-width:60px; }
.tools-controls .tt-btn, .tools-nav .tt-btn { flex:1; min-height:44px; }
.duration-mode { display:flex; gap:8px; margin:12px 0; }
.duration-mode button { flex:1; min-height:44px; }
.duration-mode [aria-pressed=true], .repeat-day[aria-pressed=true] { background:var(--accent); color:var(--on-accent); }
.tools-card select.time-wheel { height:150px; padding:0; text-align:center; font-size:20px; }
.time-wheel option { padding:8px; }
.repeat-days { gap:6px !important; }
.repeat-day { flex:1; min-width:44px; min-height:44px; border-radius:12px; border:1px solid var(--surface3); background:var(--bg); color:var(--text); font:600 16px system-ui; }
.repeat-day span { display:block; font-size:11px; }
.custom-repeat-toggle { display:flex !important; align-items:center; gap:8px; min-height:44px; }
.sound-picker summary { min-height:44px; padding:12px 0; cursor:pointer; }
.sound-list { max-height:310px; overflow:auto; }
.sound-row { display:flex; min-height:48px; border-bottom:1px solid var(--surface2); }
.sound-choice { flex:1; text-align:left; min-height:48px; background:none; border:0; color:var(--text); font:inherit; display:flex; justify-content:space-between; align-items:center; padding:10px; }
.sound-choice[aria-pressed=true] { color:var(--accent); font-weight:600; }
.sound-remove { min-height:44px; background:var(--danger); color:white; border:0; border-radius:8px; cursor:pointer; }
@media (pointer:coarse) { .sound-remove { display:none; } .show-remove .sound-remove, .sound-row:focus-within .sound-remove { display:block; } }
.sound-picker .tools-warning { padding:8px 0; }
#toolsStopwatch .tools-controls { gap:20px; margin-block:20px; }
.tools-warning { color:var(--text2); font-size:13px; padding:12px; padding-bottom:72px; }
#askFab { position:fixed; z-index:90; right:16px; bottom:calc(var(--safe-b) + 74px); width:52px; height:52px; border:0; border-radius:50%; background:var(--accent); color:var(--on-accent); font:600 14px system-ui; box-shadow:0 4px 16px rgba(0,0,0,.3); touch-action:none; }
@media(min-width:900px) { #askFab { bottom:24px; } }

@media (hover:hover) {
  button, select, [role="slider"], [role="tab"], .srch-item { cursor:pointer; }
  .conv-bar[role="slider"] { cursor:crosshair; }
}

/* ============ Tablet and up (≥600px) ============ */
@media (min-width:600px) {
  .header-inner, .app-col { max-width:880px; }
  .app-col { padding-inline:20px; }
  .header { padding-inline:20px; }
  .web-title {
    display:block; grid-column:1; grid-row:1; justify-self:start; min-width:0;
    font-size:22px; font-weight:700; letter-spacing:-.4px;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }

  /* Clocks: a responsive grid of cards instead of full-bleed rows. */
  .toolbar { border-bottom:0; padding:14px 0 10px; background:transparent; }
  .tt-panel { border:1px solid var(--surface2); border-radius:12px; margin-bottom:12px; padding:12px 14px; }
  #clockList {
    display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
    gap:12px; padding-bottom:24px;
  }
  #clockList > .empty, #clockList > .hidden-wrap { grid-column:1 / -1; }
  .hidden-wrap { padding:8px 0 0; }
  .clock-card {
    background-color:var(--surface); border:1px solid var(--surface2);
    border-radius:12px; padding:14px 16px 12px;
    box-shadow:0 1px 2px var(--card-shadow);
    transition:border-color .15s, box-shadow .15s, transform .2s;
  }
  .clock-card.day-bg, .clock-card.night-bg { background-color:var(--surface); }
  .clock-card .cc-content { background:transparent; }
  .local-card, .utc-card { background-color:color-mix(in srgb,var(--accent) 8%,var(--surface)); }
  .cc-time { font-size:42px; }
  .clock-card .cc-strip { background:color-mix(in srgb,var(--text) 13%,var(--surface)); }
  .clock-card.editing .cc-content { margin-right:92px; }
  .tt-btns { justify-content:flex-end; }
  .tt-btn { flex:0 0 auto; padding-inline:22px; }
  .clock-card.drag-over { border-top:1px solid var(--surface2); box-shadow:0 0 0 2px var(--accent); }

  /* Converter: bars and overlap use the available width. */
  .conv-row { max-width:none; padding:3px 0; gap:12px; }
  .conv-label { width:112px; font-size:12px; }
  .conv-time-lbl { width:78px; }
  .conv-hint { padding-inline:0; }
  .conv-drift { margin-inline:0; }
  .conv-overlap { padding:14px 0 24px; }
  #convOverlap { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:10px; }
  #convOverlap > .conv-overlap-none, #convOverlap > .ov-best { grid-column:1 / -1; margin:0; }
  .conv-overlap-slot {
    margin:0; padding:10px 12px; border:1px solid var(--surface2); border-radius:10px;
    transition:border-color .15s, background-color .15s;
  }
  .conv-fallback { width:100%; margin:0; }

  /* Reminders: one card-style list. */
  .rem-list { margin-top:16px; background:var(--surface); border:1px solid var(--surface2); border-radius:12px; overflow:hidden; }
  .rem-item:last-child { border-bottom:0; }
  .rem-add { width:auto; margin:16px 0; padding:12px 22px; }

  /* Sheets become centred dialogs. */
  .modal-overlay { align-items:center; padding:24px; }
  .modal-sheet {
    width:min(520px,100%); max-height:min(760px,86vh); border-radius:14px;
    padding:18px 20px 20px; box-shadow:0 24px 64px rgba(0,0,0,.35);
  }
  /* Add City: a centred search dialog over a dimmed page, not a full-screen sheet.
     The spread shadow is the scrim; web.js closes on a click outside. */
  .modal-full {
    inset:auto; top:max(10vh,calc(var(--safe-t) + 24px)); left:50%; transform:translateX(-50%);
    width:min(560px,calc(100vw - 48px)); height:auto; max-height:min(620px,78vh);
    background:var(--surface); border-radius:14px; overflow:hidden;
    border:1px solid var(--surface2);
    box-shadow:0 0 0 100vmax rgba(0,0,0,.45), 0 24px 64px rgba(0,0,0,.35);
    padding:0;
  }
  .srch-hdr { padding:10px 12px 6px 16px; }
  .srch-bar { padding:0 16px 12px; }
  .srch-results { min-height:0; }
  .srch-bar input { background:var(--bg); border:1px solid var(--surface2); }
  .srch-bar input:focus-visible { outline:2px solid var(--accent); outline-offset:0; border-radius:10px; }

  .toast { bottom:calc(var(--safe-b) + 24px); }
}

/* ============ Tablet only (600–899px): compact bottom tab bar ============ */
@media (min-width:600px) and (max-width:899px) {
  .tab-bar-inner { max-width:560px; }
  .tbn { flex-direction:row; gap:8px; font-size:13px; font-weight:500; }
  .tbn .ti { width:20px; height:20px; }
  .toast { bottom:calc(var(--safe-b) + 72px); }
}

/* ============ Wide (≥900px): sidebar web app ============ */
@media (min-width:900px) {
  :root { --side-w:236px; }
  body {
    padding-left:calc(var(--side-w) + env(safe-area-inset-left,0px));
    padding-bottom:var(--safe-b);
  }

  /* Sidebar replaces the phone tab bar. */
  .tab-bar {
    top:0; bottom:0; right:auto; width:calc(var(--side-w) + env(safe-area-inset-left,0px)); height:auto;
    flex-direction:column; gap:18px;
    padding:calc(var(--safe-t) + 18px) 12px calc(var(--safe-b) + 16px) calc(12px + env(safe-area-inset-left,0px));
    border-top:0; border-right:1px solid var(--surface2);
    background:var(--surface); backdrop-filter:none; -webkit-backdrop-filter:none;
  }
  .web-brand {
    display:flex; align-items:center; gap:10px; padding:0 10px;
    font-size:17px; font-weight:700; letter-spacing:-.2px; color:var(--text);
  }
  .web-brand img { width:26px; height:26px; border-radius:7px; }
  .tab-bar-inner { flex-direction:column; gap:2px; max-width:none; margin:0; }
  .tbn {
    flex:none; flex-direction:row; justify-content:flex-start; gap:12px;
    min-height:44px; padding:0 12px; border-radius:9px;
    font-size:14px; font-weight:500; color:var(--text2); text-align:left;
    transition:background-color .12s, color .12s;
  }
  .tbn .ti { width:20px; height:20px; }
  .tbn.active { background:color-mix(in srgb,var(--accent) 14%,transparent); color:var(--accent-text); font-weight:600; }
  .tbn:focus-visible { outline-offset:-2px; border-radius:9px; }
  .web-keys {
    display:grid; grid-template-columns:auto 1fr; gap:6px 10px; align-items:center;
    margin-top:auto; padding:12px 10px 0; border-top:1px solid var(--surface2);
    font-size:12px; color:var(--text2);
  }
  .web-keys kbd {
    font:600 11px/1 var(--font); color:var(--text2); min-width:22px; text-align:center;
    padding:4px 6px; border:1px solid var(--surface3); border-bottom-width:2px;
    border-radius:5px; background:var(--bg);
  }

  /* Header: page title on the left, actions on the right, same 1200px column. */
  .header { padding:14px 40px 12px; border-bottom:1px solid var(--surface2); }
  .header-inner { max-width:1200px; }
  .web-title { font-size:24px; }
  .app-col { max-width:1200px; padding-inline:40px; }

  #clockList { grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; padding-bottom:40px; }
  .toolbar { padding:20px 0 14px; }
  .cc-time { font-size:46px; }

  /* Meeting planner at full width. */
  .conv-header { padding:22px 0 10px; }
  .conv-sel { font-size:30px; }
  .conv-label { width:150px; font-size:13px; }
  .conv-time-lbl { width:92px; font-size:15px; }
  .conv-bar { height:48px; border-radius:7px; }
  .conv-row { padding:4px 0; }
  .conv-overlap h3 { font-size:15px; color:var(--text); margin-bottom:10px; }
  #convOverlap { grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:12px; }

  .toast { bottom:calc(var(--safe-b) + 24px); left:calc(50% + var(--side-w) / 2); }
}

/* Planner hover: a ghost marker on every bar at the hovered instant. */
@media (min-width:600px) and (hover:hover) {
  .web-ghost {
    display:block; position:absolute; top:0; bottom:0; width:2px; margin-left:-1px;
    background:var(--text); opacity:.55; pointer-events:none; z-index:4;
  }
  .web-ghost b {
    position:absolute; top:3px; left:5px; padding:2px 5px; border-radius:4px;
    font-size:11px; font-weight:700; white-space:nowrap; font-variant-numeric:tabular-nums;
    background:var(--text); color:var(--bg);
  }
  .web-ghost.flip b { left:auto; right:5px; }
  .conv-row:hover .conv-label { color:var(--text); }
  .conv-bar:hover { outline:1px solid var(--accent); }
  .conv-overlap-slot:hover { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 7%,var(--surface)); }
  .clock-card:hover { border-color:var(--surface3); box-shadow:0 4px 14px var(--card-shadow); }
  .clock-card:hover .cc-content { background:transparent; }
  .rem-item:hover { background:color-mix(in srgb,var(--surface) 92%,var(--text)); }
  .tbn:hover { color:var(--text); }
}
@media (min-width:900px) and (hover:hover) {
  .tbn:hover:not(.active) { background:var(--surface2); }
}

/* Touch devices at tablet/desktop widths keep 44px targets everywhere. */
@media (min-width:600px) and (pointer:coarse) {
  .tbn { min-height:48px; }
  .web-keys { display:none; }
}

@media print {
  body { padding-left:0 !important; }
  .web-title { display:none !important; }
}
@media (min-width:600px) {
  .empty ~ .rem-add { display:block; margin:4px auto 24px; }
}

/* October 1: shared navigation, readable cards, and adaptive reminder editing. */
[hidden] { display:none !important; }
#appMenu { position:relative; grid-column:1; grid-row:1; justify-self:start; }
#appMenu summary { display:flex; align-items:center; justify-content:center; list-style:none; width:44px; height:44px; cursor:pointer; color:var(--accent); }
#appMenu summary::-webkit-details-marker { display:none; }
#appMenu svg { width:22px; height:22px; }
#appMenu > div { position:absolute; top:48px; left:0; min-width:170px; padding:6px; background:var(--surface); border:1px solid var(--surface3); border-radius:12px; box-shadow:0 8px 30px var(--card-shadow); }
#appMenu button { display:block; width:100%; min-height:44px; border:0; border-radius:6px; color:var(--text); background:none; text-align:left; font:inherit; padding:10px; }
.web-title { margin-left:52px; }
.header:has(~ .modal-full.active) { z-index:210; }
.clock-card { margin-block:12px; border:1px solid var(--surface2); border-radius:18px; padding:20px; min-height:185px; background-color:var(--surface); }
.clock-card .cc-row1 { justify-content:center; position:relative; min-height:34px; padding-inline:58px; }
.clock-card .cc-city { justify-content:center; text-align:center; font-size:19px; }
.clock-card .cc-diff { position:absolute; right:0; font-size:12px; }
.clock-card .cc-row2 { justify-content:center; flex-wrap:wrap; gap:6px 18px; margin-block:12px; }
.clock-card .cc-time { font-size:clamp(38px,4vw,52px); }
.clock-card .cc-meta { font-size:13px; gap:14px; margin-top:14px; }
.clock-card .cc-meta [title] { cursor:help; }
.sound-choice small { display:block; color:var(--text2); font-size:12px; margin-top:4px; }
.sound-list h4 { margin:14px 10px 4px; font-size:14px; color:var(--text2); }
.cyclic-wheel { position:relative; }
.cyclic-wheel button { width:100%; min-height:44px; border:0; background:var(--surface2); color:var(--text); font:20px system-ui; }
.ordinal-buttons { display:flex; flex-wrap:wrap; gap:6px; }
.ordinal-buttons button { min-height:44px; border:1px solid var(--surface3); border-radius:8px; background:var(--surface); color:var(--text); padding:8px 12px; font:inherit; }
.ordinal-buttons button[aria-pressed=true] { background:var(--accent); color:var(--on-accent); }
.rem-label-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.rem-form-columns { display:grid; grid-template-columns:1fr; gap:20px; }
#remModal .modal-sheet { width:min(900px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); }
#remModal.custom-schedule .modal-sheet { width:min(1100px,calc(100vw - 32px)); }
#remModal .rf { display:flex; flex-direction:column; gap:10px; }
#remModal .rf label { margin-top:6px; }
#remModal .rf-section.show { margin-top:8px; }
.rem-time-pane, .rem-repeat-pane { min-width:0; }
.rem-time-pane reminder-kit-panel { margin-inline:auto; }
.web-keys > summary { min-height:44px; display:flex; align-items:center; cursor:pointer; font-size:13px; }
.web-keys > div { display:grid; grid-template-columns:auto 1fr; gap:8px; align-items:center; }
#askFab svg { width:27px; height:27px; fill:currentColor; stroke:none; }
@media(min-width:800px) {
  .rem-form-columns { grid-template-columns:420px 1fr; }
  .rem-time-pane { grid-column:1; grid-row:1; }
  .rem-label-row { grid-column:2; grid-row:1; display:flex; flex-direction:column; gap:14px; }
  .rem-repeat-pane { grid-column:1 / -1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; align-items:start; }
  #rfWeekly, #rfCustom { grid-column:1 / -1; }
  #rfCustom.show { display:grid; grid-template-columns:260px 1fr; column-gap:20px; }
  #rfCustom > label { grid-column:1; grid-row:1; }
  #rfCustom > div:first-of-type { grid-column:1; grid-row:2; align-self:start; }
  #rfMonthPattern { grid-column:2; grid-row:1 / span 2; }
  #rfOrdinals { display:grid; grid-template-columns:1fr 180px; gap:6px 12px; }
  #rfOrdinals > .ordinal-buttons { grid-column:1; grid-row:2; }
  #rfOrdinals > label { grid-column:2; grid-row:1; }
  #rfMonthWeekday { grid-column:2; grid-row:2; }
}
@media(max-width:799px) { .rem-label-row { order:-1; } }
@media(min-width:600px) { #clockList { grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:20px; } .clock-card { min-height:220px; padding:24px; } }
@media(min-width:900px) { #clockList { grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); } .web-keys { display:block; } }
@media(max-width:899px) {
  .meeting-toggle { padding-inline:116px 76px; }
  .tab-bar-inner { max-width:none; }
  .tbn { min-width:0; flex:1; font-size:10px; }
  .web-keys { display:block; position:fixed; bottom:calc(var(--safe-b) + 72px); left:12px; z-index:85; background:var(--surface); border:1px solid var(--surface3); border-radius:10px; padding:0 12px; box-shadow:0 4px 14px var(--card-shadow); }
  .web-keys[open] { max-width:calc(100vw - 24px); padding-bottom:12px; }
  .web-keys:not([open]) > div { display:none; }
  .web-keys kbd { font:600 12px ui-monospace,monospace; }
  .web-title { display:none; }
}
