/* Apple-inspired, accessible extension of the approved Tolga brand tokens. */
.install-button{
  font:800 13px/1.2 var(--font);color:var(--deep-text);background:var(--deep);border:1px solid var(--deep);
  padding:13px 18px;border-radius:999px;min-height:46px;white-space:nowrap;box-shadow:0 7px 23px #1c443b1e;
}
.install-button:hover{background:var(--deep2)}.install-button span{font-size:16px;margin-inline-start:8px}
.network-notice{position:relative;z-index:2;text-align:center;background:var(--pale);color:var(--ink);padding:10px 16px;font-size:13px;font-weight:700}
.install-guide{max-width:min(430px,calc(100vw - 24px));border:1px solid var(--line);border-radius:24px;color:var(--ink);background:var(--paper);padding:30px;box-shadow:0 25px 95px #10281d2f;text-align:right}
.install-guide::backdrop{background:#101d188c;backdrop-filter:blur(7px)}.install-guide h2{font-size:24px}.install-guide p{color:var(--muted);margin-top:12px}.install-guide button{min-height:48px;background:var(--deep);color:var(--deep-text);border:0;border-radius:16px;padding:10px 24px;margin-top:22px}
.install-guide[open]{display:block}
@media(max-width:640px){.install-button{font-size:11px;padding:8px 11px;min-height:42px;max-width:120px;white-space:normal}.info-button{font-size:0;padding:0;flex:0 0 40px;min-width:40px}.logo{font-size:clamp(19px,5vw,25px)}}
@media(prefers-reduced-motion:reduce){.install-button,.install-guide{transition:none}}
/* V0.9: single Fathi conversation under existing "تابع" action */
.tracked-timeline{display:grid;gap:12px;margin:16px 0}
.tracked-message{padding:15px;border:1px solid var(--line);border-radius:18px;background:var(--paper);display:grid;gap:8px}
.tracked-message[data-author="fathi"]{border-color:var(--accent);background:var(--pale)}
.tracked-message strong{font-size:14px;color:var(--accent)}
.tracked-message p{font-size:15px;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere}
.tracked-message small{font-size:11px;color:var(--muted)}
.tracked-privacy{display:grid;gap:10px;padding:15px;margin:18px 0;border:1px solid var(--line);border-radius:18px;background:var(--paper)}
.tracked-privacy>.outline-button{width:100%}
#followup-form{display:grid;gap:12px;margin-block:18px}
#followup-message{width:100%;min-height:120px;padding:13px;border:1px solid var(--line);border-radius:17px;background:var(--paper);color:var(--ink);font:inherit;resize:vertical}
#followup-message:focus-visible,#track-publish-consent:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.tracked-log{margin-block:20px}.tracked-log summary{cursor:pointer;font-size:14px;font-weight:700}
@media (prefers-reduced-motion: reduce){.tracked-timeline *{animation:none!important;transition:none!important}}

/* V0.9.3: deliberate message and thread actions. */
.followup-kind{display:block;min-height:52px;width:100%;max-width:100%;padding:12px 16px;border:1px solid var(--line);border-radius:16px;background:var(--paper);color:var(--ink);font:inherit}
.followup-kind:focus-visible,.tracked-delete-message:focus-visible,#toggle-close:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.tracked-delete-message{justify-self:start;min-height:44px;background:transparent;border:1px solid var(--line);color:var(--muted);border-radius:12px;padding:8px 16px;font-size:13px;font-weight:700}
.tracked-delete-message:hover{color:var(--ink);background:var(--bg)}
.thread-management{border-top:1px solid var(--line);margin-top:26px;padding-top:18px;display:grid;gap:10px}
.thread-management h3{font-size:17px;margin:0}.thread-management .privacy-small{margin-top:0}
.thread-management>.outline-button{width:100%;white-space:normal;padding:14px;line-height:1.6}
.tracked-message .tracked-delete-message{min-height:44px}

/* V0.9.4: a true compact conversation pane, retaining the same APIs and privacy boundaries. */
#track-panel.track-active .sheet-shell{
  display:flex; flex-direction:column; height:min(90dvh,780px); max-height:min(90dvh,780px);
  overflow:hidden;
}
#track-panel.track-active .sheet-head{flex:0 0 auto;padding-block:14px 11px}
#track-panel.track-active .sheet-body{
  flex:1; min-height:0; display:flex; flex-direction:column; overflow:hidden;
  padding:10px 18px 15px;
}
#track-panel.track-active .empty-track{display:none}
#track-panel.track-active #track-result{
  flex:1; min-height:0; margin:0; padding:0; border:0; border-radius:0;
  background:transparent;display:flex;flex-direction:column;overflow:hidden;
}
.thread-topline{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-block:3px 8px}
.thread-topline .result-label{font-size:13px;font-weight:800;color:var(--accent)}
.thread-switch{border:1px solid var(--line);background:var(--paper);color:var(--muted);font:inherit;font-size:12px;font-weight:700;border-radius:999px;min-height:40px;padding:8px 12px}
.thread-summary{display:grid;gap:4px;padding-bottom:10px;flex:0 0 auto}
.thread-summary .result-status{display:inline-flex;justify-self:start;align-items:center;min-height:28px;padding:3px 12px;margin:0;background:var(--pale);border-radius:999px;font-size:13px;font-weight:800;color:var(--ink)}
#tracked-question{color:var(--ink);font-size:15px;line-height:1.6;font-weight:650;max-height:84px;overflow-y:auto;overflow-wrap:anywhere}
.thread-reopen{color:var(--deep-text);background:var(--deep);border:0;border-radius:14px;min-height:46px;margin-top:5px;padding:8px 16px;font:inherit;font-size:14px;font-weight:750}
.track-settings{flex:0 0 auto;border:1px solid var(--line);border-radius:16px;background:var(--paper);margin-bottom:9px;min-height:44px}
.track-settings>summary{min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;padding:9px 14px;font-size:13px;font-weight:800;list-style:none}
.track-settings>summary::-webkit-details-marker{display:none}
.track-settings .settings-cue{font-size:18px;color:var(--muted);transition:transform .17s ease}
.track-settings[open] .settings-cue{transform:rotate(180deg)}
.track-settings-content{border-top:1px solid var(--line);max-height:35dvh;overflow-y:auto;padding:10px 13px 15px;overscroll-behavior:contain}
.track-settings .tracked-privacy{padding:10px;margin:0;gap:8px;background:var(--bg)}
.track-settings .tracked-privacy .privacy-small{margin:0}
.track-settings .tracked-log{margin:14px 0}
.track-settings .thread-management{margin-top:12px;padding-top:12px;gap:9px}
.track-settings .thread-management h3{font-size:15px}
.track-settings .thread-management>.outline-button{min-height:45px}
.track-settings .privacy-small{margin-top:8px}
#track-panel.track-active .tracked-timeline{
  display:grid;align-content:start;flex:1;min-height:65px;overflow-y:auto;overscroll-behavior:contain;
  padding:13px 10px;margin:0;background:var(--pale);border:1px solid var(--line);border-radius:18px;
  gap:10px;scrollbar-width:thin;
}
#track-panel.track-active .tracked-message{width:fit-content;max-width:94%;justify-self:start;padding:12px 14px;border-radius:17px 17px 6px 17px;background:var(--paper);gap:4px;box-shadow:0 1px 4px #00000008}
#track-panel.track-active .tracked-message[data-author="fathi"]{justify-self:end;border-color:var(--accent);border-radius:17px 17px 17px 6px;background:var(--paper)}
#track-panel.track-active .tracked-message p{font-size:14px;line-height:1.6}
#track-panel.track-active .tracked-message strong{font-size:12px}
#track-panel.track-active .tracked-message small{font-size:11px}
#track-panel.track-active #followup-form{
  flex:0 0 auto;display:grid;gap:7px;margin:8px -10px -12px;padding:10px 10px 12px;
  background:var(--paper);border-top:1px solid var(--line);z-index:1;
}
#track-panel.track-active #followup-form[hidden]{display:none}
#track-panel.track-active .composer-kind-row{display:flex;align-items:center;gap:8px}
#track-panel.track-active .composer-kind-row label{flex:0 0 auto;margin:0;font-size:12px}
#track-panel.track-active .followup-kind{flex:1;min-width:0;min-height:44px;padding:8px 10px;font-size:13px;border-radius:13px}
#track-panel.track-active #followup-kind-help{display:none}
#track-panel.track-active #followup-message-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
#track-panel.track-active #followup-message{min-height:62px;max-height:98px;resize:none;padding:10px 13px;border-radius:15px;font-size:15px;line-height:1.5}
#track-panel.track-active #send-followup{min-height:46px;border-radius:14px;font-size:14px}
#track-panel.track-active .field-label{color:var(--muted)}
#track-panel.track-active :is(.thread-switch,.track-settings>summary,.tracked-timeline,.thread-reopen):focus-visible{outline:3px solid var(--accent);outline-offset:2px}
@media(max-width:640px){
  #track-panel.track-active .sheet-shell{height:min(93dvh,var(--visible-height,93dvh));max-height:min(93dvh,var(--visible-height,93dvh))}
  #track-panel.track-active .sheet-head{padding:25px 17px 10px}
  #track-panel.track-active .sheet-head h2{font-size:21px}
  #track-panel.track-active .sheet-body{padding:9px 12px max(10px,env(safe-area-inset-bottom))}
  .thread-summary{padding-bottom:8px}
  #tracked-question{font-size:14px;max-height:70px}
  #track-panel.track-active #followup-form{margin-inline:-7px;padding-inline:7px}
}
@media(max-height:650px){
  #track-panel.track-active #followup-message{min-height:46px;max-height:70px}
  #track-panel.track-active .tracked-timeline{min-height:42px}
}
@media(prefers-reduced-motion:reduce){.track-settings .settings-cue{transition:none}}

.privacy-state-chip{margin-inline-start:auto;display:inline-flex;align-items:center;white-space:nowrap;font-size:11px;font-weight:800;color:var(--ink);background:var(--pale);padding:4px 9px;border-radius:999px}

/* V0.9.5: full-screen chat on small screens, with room for keyboard and content. */
.thread-expand{align-self:start;background:transparent;border:0;color:var(--accent);font:inherit;font-size:13px;font-weight:800;min-height:38px;padding:5px 6px;text-decoration:underline;text-underline-offset:3px}
.thread-expand[hidden]{display:none!important}.thread-expand:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
@media(max-width:640px){
  #track-panel.track-active{inset:auto 0 var(--keyboard-gap,0px) 0;margin:0;padding:0;width:100%;max-width:none;height:min(100dvh,var(--chat-height,100dvh));max-height:min(100dvh,var(--chat-height,100dvh));border-radius:0;border:0}
  #track-panel.track-active .sheet-shell{height:100%;max-height:100%;border-radius:0}
  #track-panel.track-active .sheet-head{padding:calc(10px + env(safe-area-inset-top)) 17px 9px}
  #track-panel.track-active .sheet-body{padding:6px 12px max(10px,env(safe-area-inset-bottom))}
  #tracked-question{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;max-height:none;overflow:hidden}
  #tracked-question.expanded{display:block;max-height:20dvh;overflow:auto}
  #track-panel.track-active #followup-message-label{position:static;width:auto;height:auto;padding:0;overflow:visible;clip:auto;white-space:normal;font-size:12px;line-height:1.5}
  #track-panel.track-active #followup-form{gap:5px;padding-top:7px;padding-bottom:max(8px,env(safe-area-inset-bottom))}
  #track-panel.track-active .tracked-timeline{min-height:50px;flex:1}
}
@media(max-width:640px) and (max-height:560px){
 #track-panel.track-active .sheet-head{padding-top:8px;padding-bottom:5px}
 #track-panel.track-active .thread-summary{padding-bottom:4px}
 #track-panel.track-active .sheet-body{padding-top:3px}
 #track-panel.track-active .thread-topline{margin:0 0 4px}
 #track-panel.track-active #followup-message{min-height:36px;max-height:54px}
}

/* Compact but usable while the on-screen keyboard reduces visualViewport height. */
@media(max-width:640px){
 #track-panel.track-active.keyboard-open .sheet-head{padding:5px 14px 4px;min-height:50px}
 #track-panel.track-active.keyboard-open .sheet-head h2{font-size:18px}
 #track-panel.track-active.keyboard-open .sheet-head .eyebrow{display:none}
 #track-panel.track-active.keyboard-open .thread-summary,#track-panel.track-active.keyboard-open .track-settings{display:none}
 #track-panel.track-active.keyboard-open .thread-topline{margin-bottom:3px}
 #track-panel.track-active.keyboard-open #followup-form{gap:3px;padding-top:5px;padding-bottom:5px}
 #track-panel.track-active.keyboard-open #followup-message{min-height:40px;max-height:46px}
 #track-panel.track-active.keyboard-open .tracked-timeline{padding:8px;min-height:22px}
}

/* V0.15.2: readable, full-window citizen conversation and individual consents.
   One vertical scroll instead of nested, 35dvh privacy and message scrollboxes. */
#track-panel.track-active {
  inset: 0; margin: 0; padding: 0; width: 100vw; max-width: none;
  height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0;
  background: var(--paper);
}
#track-panel.track-active .sheet-shell {
  width: 100%; height: 100%; max-height: 100%;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 0;
}
#track-panel.track-active .sheet-head {
  flex: 0 0 auto; padding: max(14px,env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid var(--line);
}
#track-panel.track-active .sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: block; width: 100%; max-width: 920px;
  margin-inline: auto; padding: 20px 22px max(30px,env(safe-area-inset-bottom));
  overscroll-behavior: contain; scrollbar-width: thin;
}
#track-panel.track-active #track-result {
  display: block; height: auto; overflow: visible;
}
#track-panel.track-active .thread-summary { gap: 10px; padding: 14px 0 20px; }
#track-panel.track-active #tracked-question {
  display: block; max-height: none; overflow: visible; -webkit-line-clamp: unset;
  font-size: 17px; line-height: 1.85; overflow-wrap: anywhere;
}
#track-panel.track-active .thread-expand { display: none; }
#track-panel.track-active .track-settings { margin: 12px 0 24px; }
#track-panel.track-active .track-settings>summary { padding: 16px; font-size: 16px; min-height: 58px; }
#track-panel.track-active .track-settings-content { max-height: none; overflow: visible; padding: 18px; }
#track-panel.track-active .tracked-timeline {
  display: grid; flex: none; overflow: visible; min-height: 0;
  padding: 18px; gap: 18px; margin: 0 0 26px;
}
#track-panel.track-active .tracked-message {
  width: min(100%,760px); max-width: 100%; gap: 10px; padding: 18px;
}
#track-panel.track-active .tracked-message p { font-size: 16px; line-height: 1.8; }
#track-panel.track-active .tracked-message strong { font-size: 15px; }
#track-panel.track-active .message-consent-control {
  display: flex; align-items: center; gap: 14px; min-height: 56px;
  font-size: 15px; line-height: 1.7; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px;
}
#track-panel.track-active .message-consent-control input { inline-size: 25px; block-size: 25px; }
#track-panel.track-active .message-consent-wrap { padding: 14px; margin-top: 16px; }
#track-panel.track-active #followup-form {
  display: grid; position: static; margin: 18px 0 0; padding: 18px 0;
  gap: 12px; border-top: 1px solid var(--line);
}
#track-panel.track-active #followup-message {
  min-height: 110px; max-height: 240px; resize: vertical; font-size: 16px;
}
#track-panel.track-active #followup-message-label {
  position: static; width: auto; height: auto; padding: 0;
  overflow: visible; clip: auto; white-space: normal; font-size: 15px;
}
@media(max-width:640px) {
  #track-panel.track-active {
    height: min(100dvh,var(--chat-height,100dvh));
    max-height: min(100dvh,var(--chat-height,100dvh));
  }
  #track-panel.track-active .sheet-head { padding: max(12px,env(safe-area-inset-top)) 16px 12px; }
  #track-panel.track-active .sheet-body { padding: 16px 16px max(24px,env(safe-area-inset-bottom)); }
  #track-panel.track-active .tracked-timeline { padding: 12px; }
  #track-panel.track-active .tracked-message { padding: 15px; }
  #track-panel.track-active #followup-form { padding: 16px 0; }
  #track-panel.track-active.keyboard-open .thread-summary,
  #track-panel.track-active.keyboard-open .track-settings { display: block; }
  #track-panel.track-active.keyboard-open .sheet-head { padding: 10px 16px; }
  #track-panel.track-active.keyboard-open #followup-message { min-height: 80px; max-height: 160px; }
}
