/* TG Workspace shared theme. Presentation only; page visibility stays in JS. */
:root {
  --bg: #f5f6fa;
  --sur: #ffffff;
  --card: #ffffff;
  --bdr: #e5e8f0;
  --acc: #4f46e5;
  --accL: #eeedff;
  --txt: #20283f;
  --muted: #748097;
  --green: #168463;
  --greenL: #eaf8f1;
  --err: #d14b59;
  --errL: #fff0f2;
  --warn: #aa721b;
  --warnL: #fff7e7;
  --purple: #7d59c4;
  --purpleL: #f3eefc;
  --radius: 16px;
  --shadow: 0 3px 14px rgba(29, 39, 72, .035);
  --focus: 0 0 0 3px rgba(79, 70, 229, .13);
}

[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  color: var(--txt);
  background: var(--bg);
  font-family: 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #dedbff; color: #302782; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
}
button { touch-action: manipulation; }
a { color: var(--acc); text-underline-offset: 3px; }
#view, #view > *, .personal-grid > *, .grid3 > *, .grid4 > *, .flowcols > * { min-width: 0; }
#view h2 { font-size: 24px; line-height: 1.35; font-weight: 700; letter-spacing: -.5px; margin: 0 0 18px; }
#view h3 { font-size: 16px; line-height: 1.45; font-weight: 650; letter-spacing: -.15px; margin: 20px 0 13px; }
#view h3:first-child { margin-top: 0; }
#view p { overflow-wrap: anywhere; }

.card {
  padding: 24px;
  margin-bottom: 20px;
  background: var(--sur);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hd {
  color: #3c4762;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.5;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.hd > .btn { flex-shrink: 0; }
.grid3, .grid4, .personal-grid { gap: 20px; }
.grid3 .card, .grid4 .card { margin-bottom: 0; }
.grid3, .grid4 { margin-bottom: 20px; }
.stat { position: relative; overflow: hidden; }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .2px; text-transform: none; margin-bottom: 12px; }
.stat .v { color: #27314c; font-size: 32px; font-weight: 700; letter-spacing: -1px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat::after { content: ''; position: absolute; width: 44px; height: 4px; right: 24px; top: 24px; background: #dcd9ff; border-radius: 8px; }

.btn {
  min-height: 38px;
  padding: 8px 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid #dfe3ed;
  border-radius: 9px;
  background: #fff;
  color: #526079;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover:not(:disabled) { background: #f7f7fd; border-color: #c7c4ed; color: #4038b2; }
.btn:active:not(:disabled) { background: #eeedfb; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; box-shadow: 0 3px 7px rgba(79, 70, 229, .14); }
.btn.pri:hover:not(:disabled) { background: #4338ca; border-color: #4338ca; color: #fff; box-shadow: 0 4px 11px rgba(79, 70, 229, .2); }
.btn.out { color: #4d5676; border-color: #dfe3ed; background: #fff; }
.btn.dim { color: #69758b; background: #f6f7fb; border-color: #e7eaf2; }
.btn.del { color: #c64a5a; border-color: #f0d3d8; background: #fff; }
.btn.del:hover:not(:disabled) { color: #b02f42; border-color: #e8b4bf; background: #fff3f5; }
.btn.sm { min-height: 30px; font-size: 12px; padding: 5px 11px; border-radius: 7px; }
.btn:disabled { opacity: .46; box-shadow: none; cursor: not-allowed; }

label { font-size: 12px; font-weight: 600; color: #59657d; margin-bottom: 7px; }
.inp,
#view input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
#view textarea,
#view select {
  min-height: 40px;
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  background: #fcfcfe;
  color: #28324a;
  border: 1px solid #dfe3ed;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
#view input::placeholder, #view textarea::placeholder { color: #a1a9ba; }
#view :is(input, textarea, select):focus:not([type='checkbox']):not([type='radio']) {
  border-color: #8c83e9;
  background: #fff;
  box-shadow: var(--focus);
}
#view :is(input, textarea, select):disabled { color: #8e98ab; background: #f1f3f8; cursor: not-allowed; }
#view input[type='checkbox'], #view input[type='radio'] {
  accent-color: var(--acc);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-right: 5px;
  vertical-align: -3px;
}
#view input[type='file'] {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
#view input[type='file']::file-selector-button {
  border: 1px solid #dfe3ed;
  padding: 7px 12px;
  border-radius: 8px;
  color: #526079;
  background: #f7f8fc;
  margin-right: 10px;
  cursor: pointer;
  font: inherit;
}
#view textarea { resize: vertical; min-height: 96px; }
#view textarea[rows='2'] { min-height: 65px; }
#view textarea[readonly] { color: #526079; background: #f8f9fc; }
.field { margin-bottom: 18px; }
.personal-row { gap: 10px; }
.personal-row > :is(input:not([type='checkbox']):not([type='radio']), select) { width: auto !important; flex: 1 1 160px; min-width: 120px; }
.personal-row > label { margin-bottom: 0; }
.personal-row .field { flex: 1 1 150px; min-width: 0; }
.hint, .personal-note { color: var(--muted); font-size: 12px; line-height: 1.8; }
.hint { margin-top: 6px; }
.personal-pre { line-height: 1.8; }

.tag { padding: 4px 9px; font-size: 11px; line-height: 1.35; font-weight: 600; border-radius: 6px; white-space: nowrap; }
.tag.g { color: #168463; background: #eaf8f1; border-color: #ceecdf; }
.tag.b { color: #6252c7; background: #f0edff; border-color: #e0dafa; }
.tag.y { color: #a16b18; background: #fff7e7; border-color: #f4e6c6; }
.tag.r { color: #c44a5c; background: #fff0f2; border-color: #f4d6dc; }
.tag.p { color: #805bb8; background: #f4effc; border-color: #e6dcf6; }
.banner { padding: 14px 17px; border-radius: 11px; font-size: 12px; line-height: 1.85; margin-bottom: 20px; }
.banner.b { color: #5a5b96; background: #f3f2fd; border-color: #e4e2f7; }
.banner.y { color: #93713d; background: #fffaef; border-color: #efe4c8; }
.personal-review { border: 1px solid var(--bdr); background: #fcfcfe; padding: 17px; border-radius: 11px; margin-bottom: 14px; }
.personal-review > :is(p, .hint) { margin-top: 8px; }
.empty { color: #929bad; padding: 46px 18px; font-size: 13px; line-height: 1.8; }

.personal-table { border: 1px solid #edf0f5; border-radius: 10px; max-height: 520px; scrollbar-gutter: stable; }
table { font-variant-numeric: tabular-nums; }
th {
  padding: 12px 14px;
  background: #f8f9fc;
  color: #7c879c;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid #e8ebf3;
  white-space: nowrap;
}
td { padding: 13px 14px; font-size: 12px; line-height: 1.65; color: #4e5b74; border-bottom: 1px solid #edf0f6; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfbfe; }
td .btn { min-height: 29px; font-size: 11px; padding: 5px 10px; }
td .tag { font-size: 10px; }
.card:has(> table) { overflow-x: auto; }

#view details { border-radius: 12px; }
#view details:not(.card) { border: 1px solid var(--bdr); background: #fcfcfe; padding: 14px 16px; margin-top: 12px; }
#view details > summary { color: #56617a; font-size: 13px; font-weight: 600; cursor: pointer; list-style-position: inside; }
#view details > summary::marker { color: #928bbd; font-size: 10px; }
#view details[open] > summary { margin-bottom: 16px; color: #3c368b; }
#view details > p { margin: 10px 0; }
#view code { border-radius: 8px; font-size: 12px; }
.toast { border-radius: 12px; padding: 14px 18px; box-shadow: 0 12px 32px rgba(32, 40, 63, .13); font-size: 13px; line-height: 1.6; font-weight: 500; }
.toast.ok { background: #f0fbf6; color: #24735c; border-color: #c7e6d9; }
.toast.no { background: #fff5f6; color: #b34253; border-color: #f0cad2; }

/* Account menus and channel workspaces */
.account-menu-heading, .wa-heading { margin: 4px 0 24px; }
.account-menu-heading .personal-note, .wa-heading .personal-note { color: #9b9fb2; font-size: 11px; letter-spacing: .5px; }
.account-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin: 22px 0; }
.account-card { padding: 21px; border-color: var(--bdr); border-radius: 14px; box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; }
.account-card:hover { border-color: #d1cdef; box-shadow: 0 6px 22px rgba(58, 49, 124, .07); }
.account-card h3 { color: #303a54; font-size: 17px; margin: 20px 0 8px !important; }
.account-card p { color: #8a94a8; font-size: 12px; margin-bottom: 22px; }
.account-card .tag { display: inline-flex; gap: 6px; align-items: center; }
.account-card .tag::before { content: ''; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.account-card .btn { justify-content: space-between; }
.account-bulk { border-color: #ddd8f7; background: #f6f4ff; padding: 14px 16px; }
#account-summary { color: var(--muted); font-size: 12px; margin-left: auto; }
#account-menu-note { font-size: 12px; color: #7e899e; margin-top: 16px; }
#account-add-form:not([hidden]) { display: flex; align-items: center; gap: 10px; padding: 18px; background: #fff; border: 1px solid var(--bdr); border-radius: 12px; margin: 18px 0; }
#account-add-form input { flex: 1; min-width: 0; }
#account-create { flex-shrink: 0; }
#account-batch-result .personal-review { color: #69758b; font-size: 12px; }
.wa-login { box-shadow: var(--shadow); padding: 28px !important; border-color: #e1def4; background: linear-gradient(115deg, #fff 40%, #faf9ff); }
.wa-login #wa-status { color: #3b3d64; font-size: 21px; letter-spacing: -.4px; line-height: 1.5; }
.wa-qr-box { box-shadow: 0 6px 22px rgba(32, 40, 63, .045); border-color: #e6e4ef; }
.wa-connected { border-color: #d4e9df; background: #fbfefc; }
.wa-connected #wa-status { color: #208166; }
.wa-error { font-size: 12px; line-height: 1.8; }
.wa-steps span { font-size: 11px; padding: 7px 12px; border-color: #e5e2f4; color: #8b87a5; }
.wa-section-nav { top: var(--shell-header-height, 72px); padding: 12px 0; margin-bottom: 8px; gap: 8px; }
.wa-section-nav a { border: 0; background: #eeedf5; color: #77738e; font-size: 12px; padding: 9px 15px; }
.wa-section-nav a:hover { color: #5146b5; background: #e7e3fb; }
.wa-contact { padding: 15px 12px; gap: 12px; }
.wa-contact:hover { background: #fbfaff; }
.wa-contact label { font-weight: 500; color: #45506b; margin: 0; overflow-wrap: anywhere; }
.wa-contact small { margin-top: 3px; font-size: 11px; color: #929bad; }
.wa-contact .btn { min-height: 31px; padding: 5px 10px; font-size: 11px; flex-shrink: 0; }
.wa-messages { background: #f7f8fc; padding: 17px; border: 1px solid #e9ecf4; border-radius: 12px; }
.wa-message { background: #fff; border-color: #e6e9f1; border-radius: 11px; padding: 12px 14px; }
.wa-mine { border-color: #d4e7df; background: #f1faf5; }
.wa-message small { font-size: 10px; color: #8e97aa; }
.wa-message p { font-size: 13px; margin-top: 5px; }
.wa-screen-scroll { border-radius: 10px; border-color: #e0e5ed; background: #f4f5f8; }
.wa-remote-controls { padding-top: 6px; gap: 8px; }
.wa-remote-controls .btn { min-height: 35px; font-size: 12px; padding: 8px 12px; }
#wa-count, #wa-chat-status, #wa-screen-status, #wa-job-status { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 9px 0; }
#wa-preview-body { font-size: 13px; }
#wa-body { margin-bottom: 12px; }
#wa-preview-image { max-width: 100%; height: auto; border-radius: 8px; margin-top: 10px; }

/* Complex forms, flow editors and permission administration. */
#access-root .card { padding: 26px; }
#access-root > .card:only-child { border-color: #e3e0f0; box-shadow: 0 10px 36px rgba(43, 38, 80, .055); }
#access-root .personal-review b { font-size: 14px; color: #3d4660; }
#access-root .personal-review form { margin-top: 16px; }
#access-root details { margin-top: 14px; }
#access-root [data-access-permission] { margin-right: 8px; }
#access-note:empty { display: none; }
.flowcols { gap: 20px; }
.nodeitem { padding: 14px 15px; border-color: #e5e8f1; border-radius: 11px; margin-bottom: 10px; transition: border-color .15s, background .15s; }
.nodeitem:hover { border-color: #d7d0f4; background: #faf9ff; }
.nodeitem.on { border-color: #a99fe8; background: #f3f0ff; box-shadow: inset 3px 0 #8274dc; }
.nodeitem .t { color: #48536c; font-size: 13px; }
.nodeitem .p { color: #8a94a7; margin-top: 6px; }
.btnrow { gap: 8px; margin-bottom: 10px; }
.phone { background: #dce0e9; padding: 10px; border-radius: 29px; box-shadow: 0 12px 25px rgba(40, 48, 74, .09), inset 0 0 0 2px #cbd1df; }
.phone .screen { border-radius: 20px; background: #eef1f7; background-image: none; }
.bubble { box-shadow: 0 2px 4px rgba(35, 47, 73, .07); }
.personal-links { gap: 9px; margin-bottom: 10px; }

@media (max-width: 1200px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flowcols { grid-template-columns: 1fr; }
  .personal-grid { grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); }
}
@media (max-width: 850px) {
  .personal-grid { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  #view h2 { font-size: 22px; }
  .card { padding: 20px; }
  .wa-section-nav { top: var(--shell-header-height, 64px); }
}
@media (max-width: 600px) {
  body { font-size: 13px; }
  .card { padding: 17px; border-radius: 13px; margin-bottom: 15px; }
  .hd { font-size: 13px; gap: 10px; margin-bottom: 17px; }
  .grid4 { gap: 12px; }
  .stat .v { font-size: 26px; }
  .stat::after { right: 16px; top: 18px; width: 24px; }
  .stat .l { font-size: 11px; }
  .btn { min-height: 40px; padding: 9px 13px; }
  .btn.sm { min-height: 32px; }
  .field { margin-bottom: 16px; }
  .personal-row { gap: 8px; }
  .personal-row > .btn { flex: 1 1 auto; }
  .personal-links { grid-template-columns: minmax(0, 1fr) auto; }
  .personal-links > :first-child { grid-column: 1 / -1; }
  .personal-table table { min-width: 580px; }
  .personal-review { padding: 14px; }
  .account-cards { grid-template-columns: 1fr; gap: 14px; }
  .account-card { padding: 18px; }
  #account-summary { margin: 8px 0 0; width: 100%; }
  #account-add-form:not([hidden]) { flex-direction: column; align-items: stretch; }
  #account-add-form input { flex-basis: auto; }
  .wa-heading, .account-menu-heading { gap: 12px; margin-bottom: 18px; }
  .wa-login { padding: 18px !important; }
  .wa-remote-controls textarea { min-width: 100%; flex-basis: 100%; }
  .wa-remote-controls .btn { flex: 1 1 auto; }
  .wa-section-nav a { padding: 9px 12px; }
  .wa-steps { gap: 6px; }
  .wa-steps span { font-size: 10px; padding: 6px 9px; }
  .wa-qr-box { min-height: 0; }
  #access-root .card { padding: 20px; }
  .toast { max-width: calc(100vw - 28px); left: 14px; right: 14px; bottom: 14px; padding: 12px 15px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.wa-section-nav button{flex:0 0 auto;white-space:nowrap;padding:9px 14px;border:1px solid var(--bdr);border-radius:8px;color:var(--muted);background:var(--sur);cursor:pointer;font:inherit;font-size:13px}.wa-section-nav button:hover,.wa-section-nav button:focus-visible{color:var(--acc);border-color:#bcb5ef;background:var(--accL)}
