/* TuloDesk Online — styled to match the Windows app (light + dark). */
:root {
  --bg: #f1f3f7; --surface: #ffffff; --surface-2: #f6f8fb; --hover: #eef1f6; --press: #e6eaf1;
  --border: rgba(15, 23, 42, 0.09); --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a; --text-2: #4b5563; --text-3: #6b7686;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-text: #2563eb; --accent-subtle: rgba(37, 99, 235, 0.1);
  --ok: #15803d; --warn: #b45309; --err: #b91c1c;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px -16px rgba(15, 23, 42, 0.22);
  --radius-card: 22px; --radius-inner: 14px;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0b1220; --surface: #162235; --surface-2: #142033; --hover: #1a2940; --press: #1d2d46;
  --border: rgba(255, 255, 255, 0.09); --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f7faff; --text-2: #aab7c8; --text-3: #8795a8;
  --accent: #3b82f6; --accent-hover: #2563eb; --accent-text: #60a5fa; --accent-subtle: rgba(59, 130, 246, 0.16);
  --ok: #4ade80; --warn: #fbbf24; --err: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 32px -18px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px; line-height: 1.4; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent-text); }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.strong { font-weight: 600; }
.body { font-size: 14px; }
.faint { opacity: 0.72; }
.center { display: flex; justify-content: center; }
.center-text { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-line; }
.mono { font-family: Consolas, 'Cascadia Mono', monospace; font-weight: 700; font-size: 15px; word-break: break-all; }

/* ── Window ─────────────────────────────────────────────────────────────── */
#app { height: 100%; display: flex; justify-content: center; }
.window { position: relative; width: 100%; max-width: 440px; height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.standalone body { background: radial-gradient(900px 500px at 50% -10%, rgba(37, 99, 235, 0.16), transparent 70%), var(--bg); }
@media (min-width: 560px) {
  .standalone #app { align-items: center; padding: 18px 0; }
  .standalone .window { height: min(100%, 980px); border-radius: 26px; border: 1px solid var(--border-strong); box-shadow: 0 30px 80px -30px rgba(15, 23, 42, 0.5); }
}
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; flex: none; }
.brand img { display: block; height: 26px; width: auto; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 14px 16px; scroll-behavior: smooth; scrollbar-width: thin; }
.scroll > * + * { margin-top: 14px; }

/* ── Buttons & controls ─────────────────────────────────────────────────── */
.ib { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); }
.ib:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.ib:active:not(:disabled) { background: var(--press); }
.ib:disabled { opacity: 0.35; cursor: default; }
.ib-round { border-radius: 50%; border: 1px solid var(--border); background: var(--surface); width: 34px; min-width: 34px; padding: 0; }
.ib-lg { width: 38px; height: 38px; min-width: 38px; }
.theme-toggle { position: relative; width: 56px; height: 32px; border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(15, 23, 42, 0.14); padding: 0; transition: background 0.2s; }
.theme-toggle.on { background: var(--accent); border-color: var(--accent); }
.theme-toggle .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 13px; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.theme-toggle.on .knob { transform: translateX(24px); background: #f7faff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; transition: background 0.15s, transform 0.1s; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline { background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn-danger:hover:not(:disabled) { background: rgba(185, 28, 28, 0.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-square { width: 42px; height: 42px; padding: 0; flex: none; border-radius: 50%; }
.pill-btn { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; }
.pill-btn:hover { background: var(--hover); }
.input { width: 100%; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.input.pill { border-radius: 999px; padding: 10px 16px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.input::placeholder { color: var(--text-3); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238795a8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.select.compact { width: auto; padding-top: 7px; padding-bottom: 7px; font-size: 13px; }
select option { color: #0f172a; background: #fff; }
:root[data-theme='dark'] select option { color: #f7faff; background: #162235; }
input[type='datetime-local'] { min-height: 42px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); }
.radio { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.radio input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── Layout helpers ─────────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-xs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-gap { display: flex; align-items: center; gap: 8px; }
.row-gap.tight { gap: 2px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-between.top, .row-gap.top { align-items: flex-start; }
.row-between.tight { gap: 6px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow); }
.clock-card { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 20px 22px; }
.clock-time { font-size: 42px; line-height: 48px; font-weight: 600; letter-spacing: -0.015em; }
.clock-date { font-size: 14px; margin-top: 2px; }
.caption { margin: 0; font-size: 12px; line-height: 16px; color: var(--text-2); }
.caption.error, .error { color: var(--err); }
.wx { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.wx-icon { font-size: 26px; line-height: 30px; }
.wx-city { font-size: 14px; font-weight: 500; }
.section-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; }
.section-head { margin: 0; font-size: 15px; font-weight: 600; }
.section-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.card-inner { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-inner); padding: 12px; }
.card-inner.tight { padding: 8px 10px; }
.card-inner.accent { border-color: var(--accent); }
.card-inner > * + * { margin-top: 6px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile.open { border-color: var(--tool); }
.tile-badge { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 13px; background: color-mix(in srgb, var(--tool) 16%, transparent); }
.tile-ico { display: block; width: 24px; height: 24px; background: color-mix(in srgb, var(--tool) 78%, #000); -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
:root[data-theme='dark'] .tile-ico { background: color-mix(in srgb, var(--tool) 68%, #fff); }
.tile-ico.big { width: 30px; height: 30px; }
.tile-title { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }

.stack-cards > * + * { margin-top: 12px; }
.widget { padding: 16px 18px 18px; transition: box-shadow 0.2s, border-color 0.2s; position: relative; }
.widget.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.widget.dragging { opacity: 0.45; }
.widget.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.widget.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.w-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: grab; margin: -4px -4px 8px 0; }
.w-title { margin: 0; font-size: 15px; font-weight: 600; user-select: none; }
.w-actions { display: flex; align-items: center; }
.w-body { animation: fade 0.25s ease; }
.widget.collapsed .w-body { display: none; }
.widget.collapsed .w-head { margin-bottom: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* expanded ("pop-out") tool */
.has-focus .clock-card, .has-focus .quick, .has-focus .promo, .has-focus .widget:not(.focus) { display: none; }
.has-focus .widget.focus { min-height: calc(100% - 4px); }
.has-focus .widget.focus.collapsed .w-body { display: block; }

/* ── Tools: shared bits ─────────────────────────────────────────────────── */
.big-result { font-size: 20px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-gap > .input.pill + select, .row-gap > select { flex: none; width: auto; min-width: 104px; }
.list-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.flag { display: inline-grid; place-items: center; width: 24px; height: 18px; border-radius: 3px; overflow: hidden; flex: none; background: var(--hover); font-size: 14px; }
.flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flag-fallback { font-size: 9px; font-weight: 700; color: var(--text-2); }
.cl { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-inner); }
.cl-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 10px 12px; border: 0; background: transparent; text-align: left; }
.cl-title { font-size: 14px; }
.cl-chev { color: var(--text-2); display: grid; }
.cl-list { overflow-y: auto; padding: 0 6px 8px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.country-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 10px; background: transparent; }
.country-row:hover { background: var(--hover); }
.country-row.active { background: var(--accent); color: #fff; }
.year-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.holiday { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-inner); align-items: center; }
.ok-mark { color: var(--ok); font-size: 18px; font-weight: 700; }
.bad-mark { color: var(--err); font-size: 18px; font-weight: 700; }

/* World clock */
.wc-rows { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.wc-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; }
.wc-name { display: flex; flex-direction: column; min-width: 0; }
.wc-time { font-size: 16px; font-variant-numeric: tabular-nums; }
.wc-right { display: flex; align-items: center; gap: 6px; min-width: 70px; justify-content: flex-end; }
.wc-sun { font-size: 15px; width: 20px; text-align: center; }
.wc-manage { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

/* Calendar */
.cal-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
.cal-label { text-align: center; }
.cal-top .ib { font-size: 20px; }
.cal-grid { display: grid; grid-template-columns: 30px repeat(7, 1fr); gap: 2px; margin-top: 6px; }
.cal-head { text-align: center; font-size: 12px; color: var(--text-2); padding: 4px 0; }
.cal-wk { text-align: center; font-size: 12px; font-weight: 700; color: #e5484d; align-self: center; }
.cal-day { border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 7px 0; font-size: 14px; }
.cal-day:hover { background: var(--hover); }
.cal-day.other { color: var(--text-3); }
.cal-day.today { border-color: var(--accent); }
.cal-day.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* PDF + codes */
.dropzone { padding: 12px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-inner); background: var(--surface-2); transition: border-color 0.15s, background 0.15s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-subtle); }
.code-preview { background: #fff; border-radius: var(--radius-inner); padding: 14px; display: grid; place-items: center; min-height: 80px; }
.code-canvas { max-width: 100%; height: auto; max-height: 240px; image-rendering: pixelated; }

/* To-do */
.swatches { display: flex; gap: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-3); }
.todo { display: flex; gap: 10px; align-items: flex-start; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--task, var(--accent)); border-radius: var(--radius-inner); background: var(--surface-2); }
.todo.done .todo-title { text-decoration: line-through; opacity: 0.55; }
.todo-check { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.todo-title { font-weight: 600; word-break: break-word; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--hover); color: var(--text-2); }
.chip.danger { background: rgba(229, 72, 77, 0.14); color: var(--err); }
.chip.prio-high { background: rgba(239, 68, 68, 0.14); color: var(--err); }
.chip.prio-medium { background: rgba(245, 158, 11, 0.16); color: var(--warn); }
.chip.prio-low { background: rgba(34, 197, 94, 0.14); color: var(--ok); }
.file-link { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; padding: 0; font-size: 12px; color: var(--accent-text); text-align: left; }
.file-link:hover { text-decoration: underline; }

/* ── Promo, sheets, toasts ──────────────────────────────────────────────── */
.promo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--radius-card); background: linear-gradient(135deg, #0b1b3a, #12315f); color: #fff; }
.promo .caption { color: #c3d3ee; }
.promo strong { font-size: 14px; }
.promo .btn { flex: none; text-decoration: none; }
.sheet-host { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.sheet-host.on { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(8, 14, 26, 0.5); backdrop-filter: blur(2px); animation: fade 0.2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; display: flex; flex-direction: column; background: var(--bg); border-radius: 24px 24px 0 0; border: 1px solid var(--border-strong); box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.5); transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.in { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.sheet-body { overflow-y: auto; padding: 8px 18px 16px; scrollbar-width: thin; }
.sheet-foot { padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.lib-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; }
.lib-row.disabled { opacity: 0.5; cursor: not-allowed; }
.lib-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.about { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.about .btn { text-decoration: none; }
#toasts { position: fixed; left: 0; right: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); animation: fade 0.2s; max-width: 90vw; }
.toast.error { background: #b91c1c; }
.toast.out { opacity: 0; transition: opacity 0.4s; }

@media (max-width: 380px) { .clock-time { font-size: 36px; } .tiles { gap: 6px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.code-preview:has(canvas[hidden]) { display: none; }

/* ── Single-tool view (embedded on the website's tool pages) ────────────── */
.solo .top, .solo .clock-card, .solo .quick, .solo .promo, .solo .w-head { display: none !important; }
.solo body { background: transparent; }
.solo .window { max-width: none; background: transparent; }
.solo .scroll { padding: 6px 4px 10px; }
.solo .widget { border: 0; box-shadow: none; background: transparent; padding: 8px 10px 10px; }
.solo .widget.collapsed .w-body { display: block; }
.solo-foot { display: block; text-align: center; font-size: 12px; color: var(--text-3); text-decoration: none; padding: 6px 0 2px; }
.solo-foot:hover { color: var(--accent-text); text-decoration: underline; }
