/* ---------- header account ---------- */
.acct-slot { display: contents; }
.acct { position: relative; }
.acct-btn { font-weight: 800; background: var(--primary); color: var(--on-primary); border-color: transparent; }
.acct-btn:hover { background: var(--primary-hover); }
.acct-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 80; min-width: 240px;
  display: grid; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 24px 50px -24px var(--shadow);
}
.acct-menu[hidden] { display: none; }
.acct-who { display: grid; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.acct-who strong { font-size: 14px; }
.acct-who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.acct-who em { font-style: normal; font-size: 11.5px; color: var(--accent); }
.acct-menu a, .acct-menu button { text-align: start; padding: 9px 12px; border-radius: 9px; border: 0; background: none; color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--hover); }
.acct-signin { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.acct-signin:hover { background: var(--primary-hover); }
.acct-signin svg { width: 16px; height: 16px; }
@media (max-width: 600px) { .acct-signin { width: 36px; padding: 0; } }

/* ---------- dialogs ---------- */
.dn-dialog { border: 0; padding: 0; background: transparent; max-width: min(520px, calc(100vw - 24px)); width: 100%; color: var(--text); }
.dn-dialog.profile { max-width: min(640px, calc(100vw - 24px)); }
.dn-dialog::backdrop { background: rgba(9, 22, 33, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dlg-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 28px 26px 22px; box-shadow: 0 40px 80px -40px var(--shadow); max-height: calc(100dvh - 32px); overflow-y: auto; animation: dlgIn var(--t-med) var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-close { position: absolute; top: 12px; inset-inline-end: 12px; }
.dlg-card h2 { font-size: 1.4rem; margin-bottom: 6px; padding-inline-end: 36px; }
.dlg-lead { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.dlg-form { display: grid; gap: 14px; }
.fld { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.fld small { font-weight: 500; color: var(--muted); }
.fld input { height: 44px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 15px; }
.fld input:focus, .ms-form input:focus, .ms-form textarea:focus, .ms-form select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px var(--accent-soft); }
html[dir="rtl"] .fld input[dir="ltr"] { text-align: right; }
.dlg-msg { font-size: 13px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 9px 12px; border-radius: 10px; }
.dlg-msg.ok { color: var(--accent); background: var(--accent-soft); }
.dlg-msg[hidden] { display: none; }
.dlg-submit { width: 100%; }
.dlg-submit[hidden] { display: none; }
.dlg-foot { margin-top: 16px; display: grid; gap: 6px; justify-items: center; font-size: 13px; color: var(--muted); text-align: center; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
.fld-set { border: 0; padding: 0; margin: 0; }
.fld-set legend { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.pick { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; font-size: 13px; transition: border-color var(--t-fast), background var(--t-fast); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--c); flex: none; }
.pick.multi i { border-radius: 3px; }
.pick:has(input:checked) { border-color: var(--secondary); background: var(--accent-soft); }
.pick:has(input:checked) i { background: var(--c); }
.pick:has(input:focus-visible) { outline: 2px solid var(--secondary); outline-offset: 1px; }

/* ---------- explorer: suggestions, goal bar ---------- */
.ctl-suggest { border-top: 0; padding-top: 0; }
.ctl-link { border: 0; background: none; color: var(--accent); font-size: 11.5px; font-weight: 700; padding: 3px 6px; border-radius: 6px; }
.ctl-link:hover { background: var(--accent-soft); }
.suggest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.suggest-list button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; }
.suggest-list button:hover { border-color: var(--secondary); }
.suggest-list i { width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.btn-mini.wide { width: 100%; justify-content: center; }
.read-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--secondary); background: var(--accent-soft); }
.goal-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 10px 0 6px; }
.goal-bar i { display: block; height: 100%; width: var(--p); background: linear-gradient(90deg, var(--secondary), var(--primary)); border-radius: inherit; transition: width var(--t-slow) var(--ease); }
html[dir="rtl"] .goal-bar i { margin-inline-start: auto; background: linear-gradient(270deg, var(--secondary), var(--primary)); }
.goal-bar.big { height: 10px; }

/* ---------- My Dental Space ---------- */
.ms { max-width: 1240px; margin: 0 auto; padding: clamp(18px, 3vw, 36px) clamp(14px, 3vw, 32px) calc(48px + env(safe-area-inset-bottom, 0px)); }
.ms-head { display: grid; grid-template-columns: 1fr minmax(260px, 380px); gap: 18px 28px; align-items: end; margin-bottom: 22px; }
.ms-kicker { font-family: var(--font-en); font-weight: 800; font-size: 13px; letter-spacing: .04em; color: var(--accent); margin-bottom: 4px; }
.ms-hello h1 { font-size: var(--fs-2xl); margin-bottom: 8px; }
.ms-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--muted); }
.spec-pill { padding: 3px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sync-dot.ok { background: #2FA37A; }
.sync-dot.err { background: var(--danger); }
.ms-guest { margin-top: 10px; font-size: 13.5px; color: var(--text); padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); max-width: 70ch; }
.ms-search { position: relative; display: block; }
.ms-search svg { position: absolute; inset-inline-start: 13px; top: 13px; color: var(--muted); pointer-events: none; }
.ms-search input { width: 100%; height: 44px; padding: 0 14px; padding-inline-start: 40px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.ms-search input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px var(--accent-soft); }

.ms-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; margin-bottom: 22px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); scrollbar-width: none; }
.ms-tabs::-webkit-scrollbar { display: none; }
.ms-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-size: 13.5px; font-weight: 700; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast); }
.ms-tabs button:hover { color: var(--text); background: var(--hover); }
.ms-tabs button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.ms-tabs svg { width: 16px; height: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 18px 16px; box-shadow: 0 16px 40px -36px var(--shadow); }
.card h2 { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.card > header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card h2 .count { font-style: normal; color: var(--muted); font-weight: 600; font-size: 12px; margin-inline-start: 6px; }
.ms-empty { color: var(--muted); font-size: 13.5px; }
.meta { font-size: 11.5px; color: var(--muted); }
.overdue { color: var(--danger); font-weight: 700; }

.ov-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.ov-profile { grid-column: span 4; display: grid; align-content: start; gap: 8px; }
.ov-quick { grid-column: span 5; }
.ov-tracks { grid-column: span 3; display: grid; align-content: start; gap: 10px; }
.ov-upcoming, .ov-recent, .ov-saved { grid-column: span 4; }
.ov-goals { grid-column: span 6; }
.ov-notes { grid-column: span 6; }
.ov-spec { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.ov-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.ov-profile .btn-mini { justify-self: start; margin-top: 6px; }
.ov-continue { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.ov-continue span { font-size: 11.5px; color: var(--accent); font-weight: 700; }
.ov-continue strong { grid-column: 1; font-size: 14px; }
.ov-continue svg { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--accent); }
html[dir="rtl"] .ov-continue svg { transform: scaleX(-1); }
.ov-track-links { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-track-links .btn-mini { text-decoration: none; }
.ov-graph { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--personal); font-weight: 700; font-size: 13.5px; }
.ov-graph em { font-style: normal; margin-inline-start: auto; color: var(--muted); font-weight: 600; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-static, .topic-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text); text-decoration: none; max-width: 100%; }
.topic-chip:hover { border-color: var(--secondary); }
.chip-static i, .topic-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.chip-wrap { display: inline-flex; align-items: center; gap: 2px; }
.icon-btn.xs { width: 22px; height: 22px; }
.icon-btn.xs svg { width: 12px; height: 12px; }

.ms-form { display: grid; gap: 10px; }
.ms-form input, .ms-form textarea, .ms-form select, .folder-new input, .it-actions select {
  width: 100%; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px;
}
.ms-form textarea { resize: vertical; line-height: 1.6; }
.ms-form .btn-mini.primary { justify-self: start; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > input, .row > select { flex: 1 1 180px; }
.row > input[type="date"] { flex: 0 1 170px; }
.inline-date { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex: 0 1 260px; }
.segmented.small { display: inline-grid; grid-template-columns: auto auto; justify-self: start; margin: 0; }
.segmented.small label { cursor: pointer; }
.segmented.small label { position: relative; }
.segmented.small input { position: absolute; opacity: 0; width: 1px !important; height: 1px; padding: 0; inset: 0; }
.segmented.small span { display: block; padding: 5px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.segmented.small input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px var(--shadow); }
.segmented.small input:focus-visible + span { outline: 2px solid var(--secondary); }

.ms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rem-row { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; padding: 8px 6px; border-radius: 10px; }
.rem-row:hover { background: var(--hover); }
.rem-row .it-actions { grid-column: 2; }
.rem-body { display: grid; gap: 4px; justify-items: start; }
.rem-body p { font-weight: 600; font-size: 14px; }
.rem-row.is-done .rem-body p { text-decoration: line-through; color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface); color: transparent; display: grid; place-items: center; padding: 0; }
.check svg { width: 15px; height: 15px; }
.check[aria-pressed="true"] { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.note-mini { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--border); }
.note-mini:last-child { border-bottom: 0; }
.note-mini p { flex: 1 1 200px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--personal); }
.goal-mini { display: grid; grid-template-columns: 1fr 120px auto; align-items: center; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.goal-mini .goal-bar { margin: 0; }
.goal-mini em { font-style: normal; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lib-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.lib-row:last-child { border-bottom: 0; }
.lib-row .kind { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 64px; }
.lib-row.is-done { opacity: .6; }
.lib-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; font-size: 13.5px; text-decoration: none; overflow-wrap: anywhere; }
.lib-link svg { width: 14px; height: 14px; flex: none; }
.lib-row .it-actions { margin-inline-start: auto; }

.split { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.main { display: grid; gap: 16px; min-width: 0; }
.main.single { max-width: 860px; }
.folders { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 2px; padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.folders button[data-folder] { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 0; background: none; color: var(--text); font-size: 13.5px; font-weight: 600; text-align: start; }
.folders button[data-folder]:hover { background: var(--hover); }
.folders button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.folders em { font-style: normal; font-size: 12px; color: var(--muted); }
.folder-row { display: flex; align-items: center; gap: 2px; }
.folder-row button[data-folder] { flex: 1; min-width: 0; }
.folder-row .icon-btn { opacity: 0; }
.folder-row:hover .icon-btn, .folder-row:focus-within .icon-btn { opacity: 1; }
.folder-new { display: flex; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.folder-new input { padding: 7px 10px; font-size: 13px; }
.switch-row.arch { margin-top: 8px; padding: 6px 4px 2px; font-size: 12.5px; }

.note-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.note-card { display: grid; gap: 8px; align-content: start; }
.note-card.is-pinned { border-color: color-mix(in srgb, var(--personal) 45%, transparent); }
.note-card h3 { font-size: 15px; }
.note-text { font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.note-card.editing { grid-column: 1 / -1; }
.it-actions { display: flex; align-items: center; gap: 2px; }
.it-actions select { width: auto; max-width: 150px; padding: 4px 8px; font-size: 12px; margin-inline-end: 4px; }
.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--secondary); } 100% { box-shadow: 0 16px 40px -36px var(--shadow); } }

.goal-card header { display: flex; align-items: center; gap: 10px; }
.goal-card h3 { font-size: 16px; flex: 1; }
.done-pill { font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }
.goal-card .range-row { margin: 10px 0; }
.goal-add { margin-top: 10px; }
.goal-summary { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.goal-summary h2 { margin: 0; }
.goal-summary .goal-bar { margin: 0; }
.goal-summary em { font-style: normal; font-weight: 800; color: var(--primary); }

.act-list { list-style: none; margin: 0; padding: 0; }
.act-list .day { font-size: 12px; font-weight: 800; color: var(--muted); padding: 14px 0 6px; }
.act-list .day:first-child { padding-top: 0; }
.act { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.act .kind, .search-list .kind { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.act .k-explore { background: var(--accent-soft); color: var(--accent); }
.act .txt { font-size: 13.5px; flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act .meta { margin-inline-start: auto; }
.search-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding: 4px 0; }
.search-list .res { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); text-align: start; padding: 8px 4px; border-radius: 9px; min-width: 0; }
.search-list .res:hover { background: var(--hover); }
.search-list .txt { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1080px) {
  .ov-profile, .ov-quick, .ov-tracks { grid-column: span 6; }
  .ov-tracks { grid-column: span 12; }
  .ov-upcoming, .ov-recent, .ov-saved { grid-column: span 6; }
  .ov-goals, .ov-notes { grid-column: span 12; }
}
@media (max-width: 820px) {
  .ms-head { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .folders { position: static; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .folders .folder-new, .folders .arch { grid-column: 1 / -1; }
  .folder-row .icon-btn { opacity: 1; }
  .ov-grid > * { grid-column: 1 / -1 !important; }
  .goal-mini { grid-template-columns: 1fr 90px auto; }
}
