:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --ok: #059669;
  --bar: #0f172a;
  --bar-text: #cbd5e1;
  --bar-hover: #1e293b;
  --bar-active: #f4f5f7;
  --bar-active-text: #0f172a;
  --shadow: 0 10px 30px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #0f172a;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2937;
    --accent: #3b82f6;
    --bar: #020617;
    --bar-text: #94a3b8;
    --bar-hover: #111827;
    --bar-active: #0b1120;
    --bar-active-text: #f1f5f9;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#root { height: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---- buttons & inputs ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 7px 12px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 8px 10px;
}
.input:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---- auth screens ---- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px;
}
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card p { margin: 0; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 28px; height: 28px; }

/* ---- shell ---- */
.shell { height: 100%; display: flex; flex-direction: column; }
.bar {
  flex: none; height: 46px; background: var(--bar); color: var(--bar-text);
  display: flex; align-items: flex-end; gap: 4px; padding: 0 8px; position: relative; z-index: 5;
}
.bar-btn {
  height: 34px; margin-bottom: 6px; border: 0; background: transparent; color: var(--bar-text);
  border-radius: 8px; padding: 0 10px; display: inline-flex; align-items: center; gap: 8px; flex: none;
}
.bar-btn:hover { background: var(--bar-hover); color: #fff; }
.bar-btn.home { font-weight: 700; color: #f1f5f9; }
.bar-btn.home img { width: 22px; height: 22px; }
.bar-btn.home.active { background: var(--bar-hover); }
.tabs { display: flex; align-items: flex-end; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px;
  border-radius: 9px 9px 0 0; color: var(--bar-text); cursor: pointer; flex: none; max-width: 220px;
  user-select: none; border: 0; background: transparent;
}
.tab:hover { background: var(--bar-hover); color: #fff; }
.tab.active { background: var(--bar-active); color: var(--bar-active-text); }
.tab .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tab .x {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; opacity: .6; border: 0; background: transparent; color: inherit; padding: 0;
}
.tab .x:hover { opacity: 1; background: rgba(127, 127, 127, .25); }
.app-icon {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; flex: none;
  color: #fff; font-size: 10px; font-weight: 700; letter-spacing: -.02em;
}
.app-icon.lg { width: 48px; height: 48px; border-radius: 12px; font-size: 17px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #334155; color: #f1f5f9;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}

.stage { flex: 1; position: relative; min-height: 0; }
.frame { position: absolute; inset: 0; background: var(--bg); }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.frame .loading {
  position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--muted);
}
.frame .loading div { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 16px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- home ---- */
.homepage { position: absolute; inset: 0; overflow: auto; padding: 40px 16px; }
.homepage-inner { max-width: 960px; margin: 0 auto; }
.homepage h1 { font-size: 26px; margin: 0 0 4px; }
.homepage .sub { color: var(--muted); margin: 0 0 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; display: grid; gap: 14px; transition: transform .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile .t-name { font-weight: 600; font-size: 16px; }
.tile .t-url { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-open { font-size: 12px; color: var(--ok); font-weight: 600; }
.empty { color: var(--muted); padding: 24px; border: 1px dashed var(--border); border-radius: 14px; text-align: center; }

/* ---- menus & modal ---- */
.menu {
  position: fixed; z-index: 50; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 220px;
}
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
  text-align: left; padding: 8px 10px; border-radius: 7px;
}
.menu button:hover { background: var(--surface-2); }
.menu .head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu .head small { display: block; color: var(--muted); }
.menu .muted { color: var(--muted); font-size: 12px; margin-left: auto; }

.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 900px;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden;
}
.modal.narrow { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px; overflow: auto; display: grid; gap: 14px; }
.seg { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 9px; border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; }
.seg button.on { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); font-weight: 600; }

.card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 12px; background: var(--surface); }
.card.off { opacity: .65; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.grid-form .wide { grid-column: span 2; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: var(--ok); }
.spacer { flex: 1; }
input[type=color] { width: 100%; height: 37px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: #0f172a; color: #f1f5f9; padding: 9px 16px; border-radius: 9px; box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .bar-btn.home span, .tab .name { display: none; }
  .tab { padding: 0 4px 0 8px; }
  .grid-form .wide { grid-column: auto; }
  .homepage { padding: 24px 16px; }
}

/* ---- home / workspace ---- */
.homepage-inner { max-width: 1280px; }
.home-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.home-head .sub { margin: 0; text-transform: capitalize; }
.app-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.app-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px 5px 6px; font-weight: 500; }
.app-chip:hover { box-shadow: var(--shadow); }
.open-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.ws-nav { display: flex; gap: 4px; align-items: center; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 18px; scrollbar-width: none; }
.ws-nav::-webkit-scrollbar { display: none; }
.ws-nav [role=tab] { border: 0; background: transparent; padding: 9px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.ws-nav [role=tab]:hover { color: var(--text); }
.ws-nav [role=tab].on { color: var(--text); border-bottom-color: var(--accent); }
.ws-nav .btn { flex: none; margin-bottom: 4px; }
.ws-loading { display: grid; place-items: center; padding: 60px; }
.callout { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.callout.warn { border-left-color: #f59e0b; }
.linklike { border: 0; background: none; color: var(--accent); padding: 0; text-align: left; font: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

.widgets { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; margin-bottom: 14px; }
.widget { grid-column: span 6; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; min-height: 140px; max-height: 560px; }
.widget.size-s { grid-column: span 4; }
.widget.size-l { grid-column: span 12; }
.widget header { display: flex; align-items: center; gap: 6px; padding: 12px 14px 8px; }
.widget h2 { font-size: 15px; margin: 0; }
.count { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 6px; }
.icon-btn { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); font-size: 14px; padding: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.widget header .icon-btn:not(:first-of-type) { opacity: 0; }
.widget:hover header .icon-btn, .widget:focus-within header .icon-btn { opacity: 1; }
@media (hover: none) { .widget header .icon-btn:not(:first-of-type) { opacity: 1; } } /* touch: no hover to reveal them */
.w-body { overflow: auto; padding: 0 8px 10px; flex: 1; }
.w-empty { color: var(--muted); padding: 14px 8px; font-size: 13px; }
.w-empty.small { padding: 4px 8px; }

.it-list { display: grid; }
.it { display: flex; gap: 10px; align-items: flex-start; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.it:hover, .it:focus-visible { background: var(--surface-2); outline: none; }
.it-main { min-width: 0; flex: 1; }
.it-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it.unread .it-title { font-weight: 600; }
.it .from { color: var(--muted); font-weight: 500; }
.it.done .it-title { text-decoration: line-through; color: var(--muted); }
.it-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 1px; }
.it-sub .over { color: var(--danger); font-weight: 500; }
.it-sub .src { font-weight: 500; }
.it-sub .err { color: var(--danger); }
.done-check { width: 17px; height: 17px; margin: 2px 0 0; flex: none; cursor: pointer; }
.fe-row .check, .fe-wrap .check { flex: none; white-space: nowrap; }
.kind-bar { width: 4px; align-self: stretch; min-height: 18px; border-radius: 2px; flex: none; display: inline-block; }
.msg-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid; margin-top: 5px; flex: none; }
.tag { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; color: var(--muted); }

.agenda { display: grid; gap: 4px; }
.ag-day { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.ag-day:first-child { border-top: 0; }
.ag-date { padding: 7px 8px; display: grid; font-size: 13px; }
.ag-date span { color: var(--muted); font-size: 12px; }
.ag-day.today .ag-date strong { color: var(--accent); }

.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 4px; }
.note { position: relative; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 12px 10px 16px; display: grid; gap: 6px; align-content: start; min-height: 120px; overflow: hidden; }
.note:hover { box-shadow: var(--shadow); }
.note-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.note p { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 160px; }
.group { margin-bottom: 16px; }
.group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 4px 8px; }
.empty { text-align: center; }

.cal { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.cal-title { margin: 0 6px; font-size: 18px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--border); gap: 1px; margin-top: 10px; }
.cal-wd { background: var(--surface-2); padding: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.cal-cell { background: var(--surface); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell.other .cal-num { opacity: .5; }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-num { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-num { background: var(--accent); color: #fff; }
.cal-chip { border: 0; text-align: left; font-size: 11.5px; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--c) 16%, transparent); border-left: 3px solid var(--c); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip.done { opacity: .5; text-decoration: line-through; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-side { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 8px; position: sticky; top: 0; }
.cal-side h3 { margin: 0; font-size: 15px; text-transform: capitalize; }

.views { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.views-side { display: grid; gap: 4px; }
.view-btn { text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.view-btn:hover { background: var(--surface); }
.view-btn.on { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); color: var(--accent); }
.views-main { display: grid; gap: 12px; min-width: 0; }
.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; }
.board-col { flex: 0 0 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; }
.board-col h3 { font-size: 14px; margin: 0 0 6px 8px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td:nth-child(2) { white-space: normal; min-width: 200px; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.rules { display: grid; gap: 10px; }
.rules .hint { margin: 0; }

.editor { display: grid; gap: 12px; }
.editor h3 { margin: 4px 0 0; font-size: 14px; }
textarea.input { resize: vertical; font: inherit; line-height: 1.5; }
.msg-head h3 { margin: 10px 0 6px; }
.msg-body { white-space: pre-wrap; margin: 0; color: var(--text); }
.links { display: grid; gap: 4px; }
.link-row { display: flex; gap: 8px; align-items: center; }
.search-results { display: grid; gap: 4px; }
.pill.err { color: var(--danger); }
.filter-ed { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.fe-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.fe-label { font-size: 12px; color: var(--muted); width: 70px; }
.fe-wrap { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 150px; overflow: auto; }
.containers { display: grid; gap: 6px; margin-top: 8px; }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0; }

@media (max-width: 900px) {
  .widget, .widget.size-s, .widget.size-l { grid-column: span 12; }
  .cal, .views { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: 10px; }
  .ag-day { grid-template-columns: 1fr; gap: 0; }
}

/* ---- signatures ---- */
.sg { display: grid; gap: 14px; }
.sg-top { display: flex; gap: 6px; flex-wrap: wrap; }
.sg-tab { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-weight: 500; }
.sg-tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.sg-tab.add { border-style: dashed; color: var(--muted); }
.sg-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sg-name { max-width: 320px; font-weight: 600; font-size: 15px; }
.sg-status { color: var(--muted); font-size: 12.5px; }
.sg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr); gap: 18px; align-items: start; }
.sg-form { display: grid; gap: 12px; }
.sg-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.sg-sec header h3 { margin: 0; font-size: 15px; }
.sg-sec header .hint { margin: 2px 0 0; }
.sg-sec h4 { margin: 0 0 8px; font-size: 13px; }
.row.nowrap { flex-wrap: nowrap; }
.tpl-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tpl { text-align: left; border: 2px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 8px; display: grid; gap: 2px; transition: border-color .15s, transform .15s; }
.tpl:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tpl small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.tpl-view { height: 104px; overflow: hidden; border-radius: 8px; background: #fff; position: relative; margin-bottom: 6px; pointer-events: none; border: 1px solid #eef0f3; }
.sig-frame { border: 0; width: 100%; display: block; background: #fff; }
.sig-frame.thumb { position: absolute; left: 0; top: 0; width: 230%; height: 230%; transform: scale(0.435); transform-origin: 0 0; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.img-pick { display: grid; gap: 8px; }
.img-pick.busy { opacity: .6; pointer-events: none; }
.drop { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 96px; border: 2px dashed var(--border); border-radius: 12px; background: var(--surface-2); color: var(--muted); padding: 10px; text-align: left; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop img { max-height: 80px; max-width: 100%; object-fit: contain; }
.drop-url { min-width: 0; overflow-wrap: anywhere; }
.drop-ico { font-size: 22px; }
.drop-act { position: absolute; right: 8px; bottom: 6px; font-size: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; }
.swatches { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--text); }
.swatches input[type=color] { width: 40px; height: 30px; }
.range { display: flex; gap: 10px; align-items: center; }
.range input { flex: 1; accent-color: var(--accent); }
.range output { font-size: 12px; color: var(--muted); min-width: 44px; text-align: right; }
.sg-preview { position: sticky; top: 0; display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.seg.small button { padding: 3px 10px; font-size: 12.5px; }
.sg-mail { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; transition: max-width .2s; margin: 0 auto; width: 100%; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.sg-mail.dark { background: #1f2023; border-color: #303236; }
.sg-mail.mobile { max-width: 375px; }
.sg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.big { padding: 10px 18px; font-size: 15px; }
.warn-hint { background: color-mix(in srgb, #f59e0b 12%, transparent); border-radius: 8px; padding: 8px 10px; }
.howto dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 10px 0 0; font-size: 13px; }
.howto dt { font-weight: 600; }
.howto dd { margin: 0; color: var(--muted); }
.sg-empty { text-align: center; padding: 50px 16px; display: grid; justify-items: center; gap: 10px; }
.sg-empty-art { font-size: 44px; }
.sg-empty h2 { margin: 0; }
.sg-empty p { max-width: 520px; }
@media (max-width: 980px) { .sg-grid { grid-template-columns: 1fr; } .sg-preview { position: static; } }
.app-icon.len-2 { font-size: 9px; }
.app-icon.len-3 { font-size: 7px; letter-spacing: -.04em; }
.app-icon.lg.len-2 { font-size: 15px; }
.app-icon.lg.len-3 { font-size: 13px; }
.mir-row { gap: 12px; }
.mir-side { display: inline-flex; align-items: center; gap: 8px; }
.mir-dir { font-size: 20px; color: var(--accent); font-weight: 700; }
.mir-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.mir-mid select { width: auto; }
@media (max-width: 700px) { .mir-grid { grid-template-columns: 1fr; } }

/* ---- files ---- */
.file-row { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.file-row:hover, .file-row:focus-visible { background: var(--surface-2); outline: none; }
.file-ico { font-size: 20px; width: 26px; text-align: center; flex: none; }
.file-acts { display: flex; gap: 2px; opacity: .6; }
.file-row:hover .file-acts { opacity: 1; }
.crumbs { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.crumbs .linklike { font-weight: 500; }
.gd-box { margin-top: 12px; padding: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 13px; }
.empty .gd-box { border: 0; align-items: center; }

/* ---- JM Autodíly ---- */
.jm-side .view-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jm-type { display: inline-flex; align-items: center; gap: 8px; }
.jm-type .kind-bar { height: 14px; }
.jm-badge { display: inline-flex; align-items: center; gap: 4px; }
.jm-new { background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.jm-status { margin-top: 10px; padding: 8px 10px; display: grid; gap: 6px; font-size: 12px; }
.jm-status .linklike { justify-self: start; }
.spinner.small { display: inline-block; width: 12px; height: 12px; border-width: 2px; vertical-align: -2px; }
.jm-summary { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.jm-list { grid-template-columns: minmax(0, 1fr); }
.jm-more { padding: 10px; text-align: center; }
.jm-detail .jm-sub { margin: 0; color: var(--muted); }
.jm-fields { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.jm-fields dt { color: var(--muted); }
.jm-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.jm-actions { flex-wrap: wrap; }
.jm-h { margin: 6px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.jm-history { display: grid; gap: 8px; }
.jm-msg { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.jm-msg summary { cursor: pointer; padding: 9px 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.jm-msg-event { font-weight: 600; }
.jm-msg-subj { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-msg-body { padding: 0 12px 12px; display: grid; gap: 8px; justify-items: start; }
.jm-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13.5px; margin: 0; max-height: 420px; overflow: auto; width: 100%; box-sizing: border-box; }
@media (max-width: 760px) {
  .views.jm, .views.jm .views-main { grid-template-columns: minmax(0, 1fr); }
  .jm-side { display: flex; flex-wrap: wrap; gap: 6px; }
  .jm-side .view-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 13px; }
  .jm-side .jm-type .kind-bar { height: 10px; }
  .jm-status { flex-basis: 100%; margin-top: 0; padding: 2px 4px; }
  .views.jm .toolbar .input { flex: 1 1 100%; min-width: 0; }
  .jm-fields { grid-template-columns: 1fr; gap: 2px; }
  .jm-fields dd { margin-bottom: 6px; }
}

/* ---------- AI assistant (Claude) ---------- */
.ai-page { display: flex; flex-direction: column; gap: 10px; max-width: 860px; margin: 0 auto; height: calc(100vh - 260px); min-height: 360px; }
.ai-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.ai-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; line-height: 1.5; font-size: 14px; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ai-msg.user p { margin: 0; }
.ai-msg.assistant { align-self: flex-start; background: var(--card, var(--bg)); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-md p { margin: 0 0 6px; } .ai-md p:last-child { margin-bottom: 0; }
.ai-md ul, .ai-md ol { margin: 4px 0 8px; padding-left: 20px; } .ai-md h4 { margin: 8px 0 4px; font-size: 14px; }
.ai-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-acts .pill, .ai-examples .pill { cursor: pointer; border: 1px solid var(--border); background: transparent; color: inherit; font: inherit; font-size: 13px; }
.ai-empty { margin: auto; text-align: center; max-width: 560px; }
.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.ai-bar { display: flex; gap: 8px; align-items: flex-end; }
.ai-input { flex: 1; resize: vertical; min-height: 44px; }
.ai-btns { display: flex; flex-direction: column; gap: 6px; }
.ai-box { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.ai-box:empty { display: none; }
.ai-label { font-weight: 600; color: var(--accent); font-size: 13px; }
.ai-out:empty { display: none; }
.ai-out { font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-tasks { display: flex; flex-direction: column; gap: 4px; }
.ai-task { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .ai-msg { max-width: 100%; } .ai-page { height: calc(100vh - 200px); } }

/* ---------- Google Disk ---------- */
.gd-connect { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 520px; margin: 40px auto; }
.gd-connect h2 { margin: 0; } .gd-logo { font-size: 40px; }
.gd-drop { border: 2px dashed transparent; border-radius: 12px; transition: border-color .15s, background .15s; }
.gd-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.gd-uploads { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; }
.gd-uploads:empty { display: none; }
.gd-up { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.gd-up span:first-child { flex: 0 1 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-up progress { flex: 1; max-width: 300px; }
.module-chip { background: var(--surface-2); }

/* ---------- main modules of the hub (Google Disk, JM Autodíly) in their own tab ---------- */
.module-frame { overflow-y: auto; }
.module-page { max-width: 1280px; margin: 0 auto; padding: 22px 24px 40px; }
.module-title { display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 0 0 16px; }
@media (max-width: 640px) { .module-page { padding: 14px 16px 30px; } }
