/* Pillodesk auth v2: Log in, Register, Forgot password */
:root {
  --sd-orange: #ff4200;
  --sd-orange-hover: #e63b00;
  --sd-orange-text: #ff6a33;
  --page: #09090b;
  --card: #141416;
  --menu: #18181b;
  --fg: #f4f4f5;
  --fg-subtle: #a1a1aa;
  --fg-muted: #8b8b94;
  --field: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --hover: rgba(255, 255, 255, 0.06);
  --ring: rgba(255, 66, 0, 0.32);
  --error: #fb7185;
  --ok: #34d399;
  --cell-empty: #1f1f23;
  --cell-closed: #3f3f46;
  --badge-bg: #431407;
  --badge-fg: #fdba74;
  --otp-bg: #18181b;
  --otp-hover: #1f1f23;
  --otp-border: #313136;
  --error-ring: rgba(251, 113, 133, 0.25);
  --tile: rgba(255, 66, 0, 0.14);
  --menu-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --panel-shadow: 0 24px 60px rgba(70, 20, 0, 0.42);
  color-scheme: dark;
}
html[data-theme="light"] {
  --sd-orange-text: #d93800;
  --page: #ffffff;
  --card: #ffffff;
  --menu: #ffffff;
  --fg: #18181b;
  --fg-subtle: #3f3f46;
  --fg-muted: #6b6b75;
  --field: #ffffff;
  --border: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.26);
  --hover: rgba(0, 0, 0, 0.05);
  --error: #be123c;
  --ok: #047857;
  --cell-empty: #f0f0f2;
  --cell-closed: #c4c4cc;
  --badge-bg: #ffedd5;
  --badge-fg: #c2410c;
  --otp-bg: #fafafa;
  --otp-hover: #f4f4f5;
  --otp-border: #d9d9de;
  --error-ring: rgba(190, 18, 60, 0.18);
  --tile: rgba(255, 66, 0, 0.1);
  --menu-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --panel-shadow: 0 24px 60px rgba(120, 40, 0, 0.28);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--page);
  color: var(--fg);
  font: 400 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--sd-orange); outline-offset: 2px; }

.auth { display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); height: 100dvh; }

/* Left pane */
.af { display: flex; flex-direction: column; min-width: 0; height: 100dvh; overflow-y: auto; padding: 20px 24px; }
.af-top, .af-foot { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--fg); text-decoration: none; border-radius: 6px; }
.brand-word { height: 19px; width: auto; }
.mark { width: 28px; height: 28px; }
.af-tools { display: flex; align-items: center; gap: 4px; }
.af-main { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 24px 0 32px; }
.view { width: min(384px, 100%); }
.view.enter { animation: rise 220ms cubic-bezier(.22, .8, .28, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* Top tools */
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--fg-subtle); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.tool:hover { background: var(--hover); color: var(--fg); }
.tool.square { width: 32px; padding: 0; justify-content: center; }
.tool svg { width: 15px; height: 15px; }
html[data-theme="light"] .ico-sun, html:not([data-theme="light"]) .ico-moon { display: none; }
.lang { position: relative; }
.lang .caret { width: 12px; height: 12px; transition: transform 120ms ease; }
.lang.open .tool { border-color: var(--sd-orange); box-shadow: 0 0 0 2px var(--ring); color: var(--fg); }
.lang.open .caret { transform: rotate(180deg); }
.menu {
  position: absolute; z-index: 20; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: 190px; margin: 0; padding: 4px;
  list-style: none; background: var(--menu); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--menu-shadow);
}
.menu[hidden] { display: none; }
.menu button { width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; font-size: 14px; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu button[aria-selected="true"] { background: rgba(255, 66, 0, 0.14); }

/* Headings */
.head { margin-bottom: 24px; }
.head h1:focus { outline: none; }
.head h1 { margin: 0; font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.02em; }
.head p { margin: 6px 0 0; color: var(--fg-muted); text-wrap: balance; }
.head p strong { color: var(--fg); font-weight: 500; overflow-wrap: anywhere; }

/* Stepper: segmented progress and "Step n/total" */
.steps { margin: 0 0 28px; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 0 0 20px; padding: 0; list-style: none; }
.bars li { position: relative; height: 4px; overflow: hidden; border-radius: 2px; background: var(--border); }
.bars li::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--sd-orange); transform: scaleX(0); transform-origin: left; }
.bars li.done::after, .bars li.current::after { transform: none; }
.view.enter .bars li.current::after { animation: fill 520ms cubic-bezier(.22, .8, .28, 1) 80ms both; }
@keyframes fill { from { transform: scaleX(0); } }
.step-of { margin: 0; color: var(--sd-orange-text); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Step footer: Back on the left, next step on the right */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; padding-top: 20px; border-top: 1px solid var(--border); }
.foot .btn { width: auto; }
.foot .btn-primary { min-width: 128px; padding: 0 16px; }
.foot .note { font-size: 13px; color: var(--fg-muted); }
.foot .note a { color: var(--fg); font-weight: 600; text-decoration: none; }
.foot .note a:hover { text-decoration: underline; }
.btn-secondary { padding: 0 14px; background: var(--field); color: var(--fg-subtle); }
.btn-secondary:hover { background: var(--hover); border-color: var(--border-strong); color: var(--fg); }
/* OAuth */
.oauth { display: grid; gap: 8px; }
.oauth.row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px; background: transparent; font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.btn svg { width: 15px; height: 15px; }
.btn-oauth { background: var(--field); }
.btn-oauth:hover { background: var(--hover); border-color: var(--border-strong); }
.btn-primary { border-color: transparent; background: var(--sd-orange); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--sd-orange-hover); }
.btn-primary[aria-busy="true"] { pointer-events: none; color: transparent; position: relative; }
.btn-primary[aria-busy="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--fg-muted); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Fields */
form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.l { font-size: 13px; font-weight: 500; color: var(--fg-subtle); }
.input-wrap { position: relative; }
.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--field);
  font-size: 14px; transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input.has-eye { padding-right: 40px; }
.input::placeholder { color: var(--fg-muted); opacity: .8; }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--sd-orange); box-shadow: 0 0 0 2px var(--ring); }
.input.invalid { border-color: var(--error); }
.input.invalid:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--error) 30%, transparent); }
.input::-ms-reveal { display: none; }
.eye { position: absolute; top: 5px; right: 5px; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--fg-muted); cursor: pointer; }
.eye:hover { background: var(--hover); color: var(--fg); }
.eye svg { width: 15px; height: 15px; }
.hint { margin: 0; font-size: 12.5px; color: var(--fg-muted); }
.err { margin: 0; font-size: 12.5px; color: var(--error); }
.err[hidden] { display: none; }
.banner { margin: 0 0 16px; padding: 9px 12px; border: 1px solid color-mix(in srgb, var(--error) 40%, transparent); border-radius: 8px; color: var(--error); font-size: 13px; }
.banner.info { border-color: var(--border); color: var(--fg-subtle); }
.banner[hidden] { display: none; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-subtle); cursor: pointer; }
.check input { appearance: none; width: 16px; height: 16px; margin: 0; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--field); cursor: pointer; }
.check input:checked { border-color: var(--sd-orange); background: var(--sd-orange); }
.check input:checked::after { content: ""; width: 8px; height: 4px; margin-top: -2px; border: solid #fff; border-width: 0 0 1.6px 1.6px; transform: rotate(-45deg); }
.link { color: var(--sd-orange-text); font-size: 13px; font-weight: 500; text-decoration: none; border: 0; padding: 0; background: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link[disabled] { color: var(--fg-muted); cursor: default; text-decoration: none; font-weight: 400; font-variant-numeric: tabular-nums; }
.switch { margin: 20px 0 0; text-align: center; font-size: 13px; color: var(--fg-muted); }
.switch a, .switch button { color: var(--fg); font-weight: 600; font-size: 13px; text-decoration: none; border: 0; padding: 0; background: none; cursor: pointer; }
.switch a:hover, .switch button:hover { text-decoration: underline; }
.switch .back { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--fg-subtle); }
.switch .back svg { width: 14px; height: 14px; }
.legal { margin: 0; font-size: 12px; color: var(--fg-muted); }
.legal a { color: var(--fg-subtle); text-underline-offset: 2px; }

/* Code input: six quiet boxes, neutral colours only */
.otp { display: flex; gap: 8px; }
.otp-group { flex: 2 1 0; min-width: 0; display: flex; gap: 8px; }
.otp-sep { display: none; }
.otp input {
  flex: 1 1 0; width: 0; min-width: 0; height: 48px; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; appearance: none;
  background: var(--field); color: var(--fg); caret-color: var(--fg); outline: none;
  font: 500 20px/1 Inter, sans-serif; font-variant-numeric: tabular-nums; text-align: center;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.otp input:hover { border-color: var(--border-strong); }
.otp input:focus { border-color: var(--fg-muted); box-shadow: 0 0 0 3px var(--hover); }
.otp input[aria-invalid="true"] { border-color: var(--error); }
.otp input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--error-ring); }
.otp.shake { animation: shake 300ms ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.otp-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--fg-muted); }

/* New password checks */
.rules { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--fg-muted); }
.rules li { display: flex; align-items: center; gap: 6px; }
.rules svg { width: 12px; height: 12px; opacity: .55; }
.rules li.ok { color: var(--ok); }
.rules li.ok svg { opacity: 1; }

/* Welcome: one calm moment */
.welcome { text-align: center; }
.welcome > * { animation: soft 700ms cubic-bezier(.22, .8, .28, 1) both; }
.welcome-mark { position: relative; width: 56px; height: 56px; margin: 0 auto 28px; }
.welcome-mark::before { content: ""; position: absolute; inset: -44px; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 66, 0, .16), rgba(255, 66, 0, 0)); }
.welcome-mark .mark { width: 56px; height: 56px; }
.welcome h1 { margin: 0; font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; animation-delay: 120ms; }
.welcome h1:focus { outline: none; }
.welcome p { margin: 8px 0 32px; color: var(--fg-muted); animation-delay: 220ms; }
.welcome .btn { width: auto; min-width: 180px; padding: 0 20px; animation-delay: 340ms; }
@keyframes soft { from { opacity: 0; transform: translateY(8px); } }

/* Right pane: floating panel built from the Overview components */
.ap {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px;
  min-width: 0; margin: 10px 10px 10px 0; padding: 32px; overflow: hidden; border-radius: 16px; isolation: isolate;
  background: #ff6a20 url("/auth/gradient-v2.webp?v=1") 88% 0 / cover no-repeat;
}
.ap::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(190, 52, 0, .34) 0, rgba(190, 52, 0, 0) 42%); }
.ap::after { content: ""; position: absolute; inset: 0; z-index: -1; background: url("/auth/grain-256.png?v=1"); opacity: .1; mix-blend-mode: overlay; pointer-events: none; }
.slogan { margin: 0; color: #fff; font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -0.038em; text-align: center; }
.slogan .queue { position: relative; font-family: "Bricolage Grotesque", Inter, sans-serif; font-optical-sizing: auto; letter-spacing: -0.04em; }
.slogan .queue::after {
  content: ""; position: absolute; left: -4%; width: 112%; bottom: -7px; height: 11px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' fill='none'%3E%3Cpath d='M2 8.2C20 3.2 38 10 56 6.4 74 2.8 92 10.4 118 5' stroke='%23FFFFFF' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
/* Inbox panel: a trimmed Tickets inbox, list on the left and the open ticket on the right */
.ibx {
  width: min(660px, 100%); height: 460px; display: grid; grid-template-columns: minmax(210px, 42%) minmax(0, 1fr); gap: 4px; padding: 4px;
  border: 1px solid rgba(255, 255, 255, .34); border-radius: 15px; background: rgba(255, 255, 255, .2); box-shadow: var(--panel-shadow); backdrop-filter: blur(14px);
  text-align: left;
}
.ib-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-radius: 11px; background: var(--card); color: var(--fg); }
.ib-lh { padding: 12px 12px 10px; border-bottom: 1px solid var(--border); }
.ib-lh h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.ib-lh em { min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--hover); font-style: normal; font-size: 11.5px; color: var(--fg-subtle); }
.ib-seg { display: grid; grid-template-columns: repeat(3, auto); gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; font-size: 11.5px; color: var(--fg-muted); text-align: center; }
.ib-seg span { padding: 3px 4px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-seg .on { background: var(--hover); color: var(--fg); font-weight: 500; }
.ib-day { margin: 0; padding: 10px 12px 6px; border-bottom: 1px solid var(--border); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.ib-list { flex: 1; min-height: 0; margin: 0; padding: 0; overflow: hidden; list-style: none; }
.ib-row { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--border); transition: background 240ms ease; }
.ib-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--sd-orange); opacity: 0; transition: opacity 240ms ease; }
.ib-row.sel { background: var(--hover); }
.ib-row.sel::before { opacity: 1; }
.ib-r1 { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-subtle); }
.ib-r1 .ib-when { margin-left: auto; color: var(--fg-muted); font-size: 11px; white-space: nowrap; }
.ib-who { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ib-av { width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%; background: var(--hover) center / cover no-repeat; }
.ib-title { display: flex; align-items: center; gap: 6px; margin: 5px 0 1px; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.ib-title span { overflow: hidden; text-overflow: ellipsis; }
.ib-title i { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--sd-orange); }
.ib-prev { margin: 0; font-size: 11.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-chips { display: flex; align-items: center; gap: 4px; margin-top: 7px; overflow: hidden; white-space: nowrap; }
.ib-chips .ib-id { flex-shrink: 0; margin-left: auto; font-size: 11px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 5px; flex-shrink: 0; border-radius: 5px; font-size: 10.5px; font-weight: 500; white-space: nowrap; }
.chip i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.chip.wait { background: var(--badge-bg); color: var(--badge-fg); }
.chip.new { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.chip.prio { border: 1px solid var(--border); color: var(--fg-subtle); }
.chip.prio svg { width: 9px; height: 9px; }

.ib-ch { padding: 12px 14px 0; border-bottom: 1px solid var(--border); }
.ib-meta { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 11.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.ib-ch h4 { margin: 6px 0 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-tabs { display: flex; gap: 16px; font-size: 12px; color: var(--fg-muted); }
.ib-tabs span { padding-bottom: 7px; }
.ib-tabs .on { color: var(--fg); font-weight: 500; box-shadow: inset 0 -2px 0 var(--sd-orange); }
.ib-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; padding: 14px; overflow: hidden; -webkit-mask-image: linear-gradient(transparent 0, #000 36px); mask-image: linear-gradient(transparent 0, #000 36px); }
.msg { display: grid; gap: 5px; max-width: 88%; }
.msg.me { justify-self: end; align-self: flex-end; justify-items: end; }
.msg-h { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 11.5px; color: var(--fg-muted); }
.msg-h b { color: var(--fg); font-weight: 600; }
.msg.me .msg-h { flex-direction: row-reverse; }
.ib-me { width: 16px; height: 16px; display: grid; place-items: center; flex-shrink: 0; border-radius: 4px; background: var(--sd-orange); color: #fff; font-size: 9.5px; font-weight: 700; }
.bubble { margin: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--field); font-size: 12.5px; line-height: 1.45; }
.msg.me .bubble { background: var(--hover); }
.ib-status { align-self: center; margin: 0; font-size: 11px; color: var(--fg-muted); }
.ib-anim > * { animation: soft 520ms cubic-bezier(.22, .8, .28, 1) both; animation-delay: var(--d, 0ms); }
.ib-compose { margin: 0 12px 12px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--field); }
.ib-compose p { margin: 0 0 14px; font-size: 12px; color: var(--fg-muted); }
.ib-cbar { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--fg-muted); }
.ib-send { height: 24px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 6px; background: var(--sd-orange); color: #fff; font-size: 11.5px; font-weight: 600; }
@media (max-height: 760px) {
  .ibx { height: 380px; }
  .ap { gap: 28px; }
  .af-main { padding: 8px 0 12px; }
  .steps { margin-bottom: 18px; }
  .bars { margin-bottom: 14px; }
  .head { margin-bottom: 16px; }
  .divider { margin: 14px 0; }
  .switch { margin-top: 14px; }
}
@media (max-width: 1023px) {
  .auth { grid-template-columns: 1fr; }
  .ap { display: none; }
}
@media (max-width: 480px) {
  .af { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .view.enter, .welcome > *, .otp.shake, .ib-anim > *, .bars li::after { animation: none; transition: none; }
}

/* Live app additions */
.otp-err.info { color: var(--fg-muted); }
.banner.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
@media (max-height: 760px) {
  .af { padding-top: 14px; padding-bottom: 14px; }
  .af-main { padding: 4px 0 8px; }
}
