:root {
  color-scheme: light;
  --canvas: #F5F4F1;
  --paper: #FFFFFF;
  --paper-soft: #EFEEE9;
  --ink: #262522;
  --button: #5B5B58;
  --button-hover: #6A6966;
  --muted: #6C6860;
  --line: #E3E0D9;
  --accent-amber: #805A20;
  --accent-amber-bright: #A97732;
  --accent-amber-wash: #F5EBD8;
  --accent-orange: #B25320;
  --accent-orange-bright: #C4612B;
  --accent-orange-wash: #FAEBE2;
  --accent-hover: #924219;
  --accent: var(--accent-orange);
  --accent-bright: var(--accent-orange-bright);
  --accent-wash: var(--accent-orange-wash);
  --danger: #8E4338;
  --danger-wash: #F9EEEB;
  --shadow: 0 14px 36px rgba(38, 37, 34, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; margin: 0; color: var(--ink); background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 3px; }
::selection { color: var(--ink); background: var(--accent-wash); }
.hidden { display: none !important; }

.mt-shell { width: min(100%, 1480px); margin: 0 auto; padding: clamp(18px, 3vw, 40px); }
.mt-card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.mt-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mt-brand-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mt-brand { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.mt-brand-logo { display: block; width: 144px; height: auto; }
.mt-brand-logo-small { width: 70px; }
.mt-header-divider { width: 1px; height: 26px; background: var(--line); }
.mt-header h1 { margin: 0; color: var(--muted); font-size: 1rem; font-weight: 600; }
h1, h2, h3, p { margin-top: 0; }
h2 { color: var(--ink); line-height: 1.25; }
.mt-status { color: var(--muted); font-size: .9rem; line-height: 1.5; }

button { min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; background: var(--button); color: #FFFFFF; font-weight: 650; transition: background-color .16s ease, border-color .16s ease, transform .16s ease; }
button:hover { background: var(--button-hover); }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .55; }
input, textarea, select { min-width: 0; color: var(--ink); background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; }
input::placeholder, textarea::placeholder { color: #77736C; opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--accent); }
.mt-small-button { width: auto; padding: 8px 13px; }
.mt-header-actions { display: flex; align-items: center; gap: 9px; }
.mt-nav-link { display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--button); color: #FFFFFF; text-decoration: none; font-weight: 650; }
.mt-nav-link:hover { background: var(--button-hover); color: #FFFFFF; }

.mt-agent-activity { padding: 22px; margin-bottom: 18px; }
.mt-activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.mt-activity-head h2 { margin: 0 0 6px; font-size: 1.15rem; }
.mt-activity-head p { margin: 0; }
.mt-activity-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mt-period-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper-soft); }
.mt-period-toggle button { min-height: 36px; padding: 7px 12px; border: 0; background: transparent; color: var(--muted); box-shadow: none; }
.mt-period-toggle button:hover { background: #FFFFFF; color: var(--ink); }
.mt-period-toggle button[aria-pressed="true"] { background: var(--button); color: #FFFFFF; }
.mt-activity-measure { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.mt-activity-measure select { min-height: 40px; padding: 7px 30px 7px 10px; }
.mt-activity-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 20px 0 8px; }
.mt-activity-total { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-soft); }
.mt-activity-total.mt-activity-personal { border-color: var(--accent-bright); background: var(--accent-wash); }
.mt-activity-current-agent { background: var(--accent-wash); }
.mt-activity-current-agent th { color: var(--accent-hover); }
.mt-activity-total strong { display: block; font-size: 1.3rem; line-height: 1.25; }
.mt-activity-total span { display: block; margin-top: 3px; color: var(--muted); font-size: .82rem; }
#mt-activity-status { min-height: 1.4em; margin: 10px 0 4px; }
.mt-activity-chart-wrap { width: 100%; overflow-x: auto; }
.mt-activity-chart { display: block; width: 100%; min-width: 590px; height: auto; overflow: visible; }
.mt-chart-grid { stroke: var(--line); stroke-width: 1; }
.mt-chart-axis { fill: var(--muted); font: 12px ui-sans-serif, system-ui, sans-serif; }
.mt-chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mt-chart-point { stroke: #FFFFFF; stroke-width: 2; cursor: help; }
.mt-chart-point:focus-visible { stroke: var(--ink); stroke-width: 4; outline: none; }
.mt-activity-legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 18px; }
.mt-legend-button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; background: #FFFFFF; color: var(--ink); font-size: .85rem; box-shadow: none; }
.mt-legend-button:hover { background: var(--paper-soft); color: var(--ink); }
.mt-legend-button[aria-pressed="false"] { opacity: .55; text-decoration: line-through; }
.mt-legend-swatch { width: 10px; height: 10px; border-radius: 50%; }
.mt-activity-table-wrap { max-width: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
.mt-activity-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mt-activity-table th, .mt-activity-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.mt-activity-table th:first-child, .mt-activity-table td:first-child { text-align: left; }
.mt-activity-table th { color: var(--muted); font-size: .78rem; font-weight: 650; }
.mt-activity-agent { display: inline-flex; align-items: center; gap: 9px; }
.mt-activity-agent .mt-legend-swatch { flex: 0 0 auto; }

.mt-auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 840px; margin: 5vh auto 0; }
.mt-org-heading { margin: 0 0 16px; }
.mt-org-heading h2 { margin: 0; font-size: 1.15rem; }
.mt-team { padding: 22px; margin: 22px 0 20px; }
.mt-team h2 { margin-bottom: 14px; font-size: 1.1rem; }
.mt-settings-page { max-width: 1100px; margin: 0 auto; }
.mt-settings-card { padding: 22px; margin: 0 0 18px; }
.mt-settings-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.mt-settings-section-head h2 { margin: 0 0 5px; font-size: 1.1rem; }
.mt-settings-section-head p { margin: 0; }
.mt-settings-table-wrap { max-width: 100%; overflow-x: auto; }
.mt-settings-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mt-settings-table th, .mt-settings-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.mt-settings-table th { font-weight: 650; }
.mt-settings-table thead th { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.mt-settings-table tbody th strong, .mt-settings-secondary { display: block; }
.mt-settings-secondary { margin-top: 3px; color: var(--muted); font-size: .84rem; font-weight: 400; }
.mt-settings-badge { display: inline-block; padding: 4px 9px; border-radius: 99px; background: var(--paper-soft); color: var(--muted); font-size: .78rem; text-transform: capitalize; }
.mt-settings-badge.is-active { background: var(--accent-wash); color: var(--accent-hover); }
.mt-settings-row-actions { display: flex; gap: 7px; }
.mt-secondary-button { min-height: 36px; padding: 6px 10px; background: var(--paper-soft); border-color: var(--line); color: var(--ink); font-size: .82rem; }
.mt-secondary-button:hover { background: var(--accent-wash); color: var(--ink); }
.mt-danger-button { min-height: 36px; padding: 6px 10px; background: var(--danger-wash); border-color: var(--line); color: var(--danger); font-size: .82rem; }
.mt-danger-button:hover { background: #F2E0DB; color: var(--danger); }
.mt-settings-invite-form { max-width: 640px; border-top: 0; padding: 0; margin-bottom: 10px; }
.mt-settings-invite-form input { flex: 1; min-height: 42px; padding: 10px 12px; }
#mt-settings-invite-result { min-height: 1.3em; margin: 0 0 10px; }
#mt-org-title { margin-bottom: 8px; font-size: 1.15rem; }
#mt-org-mt { overflow-wrap: anywhere; color: var(--ink); }
#mt-embed-code { display: block; width: 100%; margin: 14px 0 20px; padding: 14px; color: var(--ink); background: var(--paper-soft); border-color: var(--line); font: .82rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }
.mt-embed-advanced { margin: 4px 0 18px; }
.mt-embed-advanced summary { width: fit-content; color: var(--ink-soft); cursor: pointer; font-size: .92rem; }
.mt-embed-advanced .mt-status { margin: 10px 0 0; }
.mt-embed-actions { display: flex; align-items: center; gap: 12px; }
.mt-embed-actions p { min-height: 1.3em; margin: 0; }
.mt-embed-actions button { background: var(--accent); }
.mt-embed-actions button:hover { background: var(--accent-hover); }
.mt-widget-setup { padding: clamp(18px, 3vw, 28px); }
.mt-widget-steps { display: grid; gap: 12px; padding-left: 24px; margin: 18px 0 22px; color: var(--ink); line-height: 1.55; }
.mt-widget-steps li { padding-left: 4px; }
.mt-widget-login-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-soft); font-weight: 650; line-height: 1.45; }
.mt-widget-login-help { margin: 9px 0 16px; }
.mt-widget-setup .mt-embed-actions { margin-top: 15px; }
.mt-widget-setup #mt-embed-code { min-height: 250px; }
.mt-widget-example { max-width: 100%; margin: 10px 0 0; padding: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-soft); color: var(--ink); font: .82rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
#mt-invite-form { max-width: 620px; }
#mt-invite-form input { flex: 1; min-height: 42px; padding: 10px 12px; }
#mt-invite-result { margin: 10px 0 0; }
.mt-auth-card { padding: clamp(20px, 3vw, 30px); }
.mt-auth-card h2 { margin-bottom: 20px; font-size: 1.2rem; }
.mt-auth-link { margin: 12px 0 0; font-size: .9rem; }
.mt-auth-link a { color: var(--accent); text-underline-offset: 3px; }
.mt-auth-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: .9rem; }
.mt-auth-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-underline-offset: 3px; }
.mt-auth-links .mt-auth-link-action { font-size: .84rem; }
.mt-auth-card #mt-login-submit { width: 100%; margin-top: 4px; }
.mt-auth-card label { display: block; margin: 15px 0; color: var(--ink); font-size: .92rem; font-weight: 650; }
.mt-auth-card input { display: block; width: 100%; min-height: 44px; margin-top: 7px; padding: 10px 12px; }
.mt-workspace-picker { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 12px; margin: 15px 0; }
.mt-workspace-picker label { margin: 0; font-weight: 650; }
.mt-workspace-picker select { width: 100%; min-height: 44px; padding: 9px 12px; }
.mt-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: .9rem; }

.mt-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 18px; }
.mt-stat { position: relative; width: 100%; min-height: 88px; padding: 16px 18px; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: 0 5px 18px rgba(38, 37, 34, .04); }
.mt-stat:hover { border-color: var(--accent-bright); background: var(--accent-wash); color: var(--ink); }
.mt-stat strong, .mt-stat span { display: block; }
.mt-stat strong { margin-bottom: 2px; font-size: 1.55rem; line-height: 1.1; }
.mt-stat span { color: var(--muted); text-transform: capitalize; }
.mt-stat.active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.mt-stat.active span { color: #E8E4DC; }
.mt-stat.active[data-filter="new"] { background: var(--button); border-color: var(--button); color: #FFFFFF; }
.mt-stat.active[data-filter="new"] span { color: #FFFFFF; }
.mt-stat .mt-stat-badge { position: absolute; top: 10px; right: 12px; display: inline-flex; align-items: center; justify-content: center; min-width: 25px; min-height: 25px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-soft); color: var(--ink); font-size: .78rem; font-weight: 750; line-height: 1; text-transform: none; }
.mt-stat.active .mt-stat-badge { border-color: var(--accent-bright); background: var(--accent-wash); color: var(--ink); }

.mt-notification-settings { display: grid; grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1fr) minmax(200px, .9fr); align-items: start; gap: 20px; padding: 22px; margin-bottom: 20px; }
.mt-notification-settings h2 { margin-bottom: 7px; font-size: 1.05rem; }
.mt-notification-settings p { margin-bottom: 0; }
.mt-notification-settings fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.mt-notification-settings legend { margin-bottom: 10px; color: var(--ink); font-weight: 700; }
.mt-notification-settings fieldset label, .mt-oncall-list label { display: flex; align-items: flex-start; gap: 9px; margin: 9px 0; color: var(--ink); font-size: .92rem; line-height: 1.4; }
input[type="checkbox"], input[type="radio"] { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); }
.mt-oncall-list { display: grid; gap: 2px; max-height: 154px; overflow: auto; }
.mt-oncall-list label { overflow-wrap: anywhere; }
.mt-oncall-list.disabled { opacity: .58; }
.mt-notification-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.mt-notification-actions button { background: var(--accent); }
.mt-notification-actions button:hover { background: var(--accent-hover); }
#mt-notification-result { min-height: 1em; margin: 0; color: var(--muted); font-size: .9rem; }

.mt-dashboard { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.mt-list { max-height: min(74vh, 900px); overflow-y: auto; padding: 8px; }
.mt-thread { display: block; width: 100%; min-height: 82px; padding: 14px; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 10px; background: #FFFFFF; color: var(--ink); font-weight: 400; box-shadow: none; }
.mt-thread:hover { background: var(--paper-soft); color: var(--ink); }
.mt-thread.selected { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.mt-thread strong { display: block; overflow: hidden; color: var(--ink); font-size: .96rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mt-thread span { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: .82rem; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.mt-panel { display: flex; min-height: 620px; min-width: 0; min-height: min(620px, 72dvh); flex-direction: column; overflow: hidden; }
.mt-panel-head { padding: 20px; border-bottom: 1px solid var(--line); }
.mt-panel-head h2 { margin-bottom: 8px; overflow-wrap: anywhere; font-size: 1.15rem; }
.mt-panel-head p { margin-bottom: 6px; }
.mt-panel-head .mt-status-select, .mt-assign-label { display: inline-flex; align-items: center; min-height: 42px; margin: 7px 8px 0 0; vertical-align: middle; }
.mt-status-select { width: auto; padding: 8px 30px 8px 10px; border-radius: 9px; background-color: #FFFFFF; }
.mt-assign-label { gap: 8px; color: var(--muted); font-size: .9rem; }
.mt-assign-label .mt-status-select { max-width: 240px; min-height: 40px; }
.mt-panel .mt-messages { flex: 1; height: auto; min-height: 250px; }

.mt-messages { height: 370px; min-width: 0; overflow: auto; padding: 18px; background: #FBFAF8; }
.mt-message { width: fit-content; max-width: min(82%, 620px); padding: 11px 14px; margin: 9px 0; border: 1px solid transparent; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.mt-message.visitor { margin-left: auto; background: var(--accent); color: #FFFFFF; }
.mt-message.agent { background: var(--paper-soft); border-color: var(--line); color: var(--ink); }
.mt-form { display: flex; align-items: stretch; gap: 9px; padding: 13px; border-top: 1px solid var(--line); background: #FFFFFF; }
.mt-form input, .mt-form textarea { flex: 1; min-height: 44px; padding: 11px 12px; }
.mt-form textarea { resize: vertical; }
.mt-form button { flex: 0 0 auto; padding: 0 18px; }
.mt-contact { padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--paper-soft); }
.mt-contact p { margin: 0 0 8px; color: var(--muted); font-size: .87rem; }
.mt-contact input { display: block; width: 100%; min-height: 40px; margin: 7px 0; padding: 9px 11px; }
.mt-contact button { width: auto; padding: 8px 12px; background: var(--accent); }
.mt-contact button:hover { background: var(--accent-hover); }
.mt-branding { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 7px 12px; border-top: 1px solid var(--line); background: #FFFFFF; color: var(--muted); font-size: .72rem; letter-spacing: .01em; }
.mt-branding strong { color: var(--ink); font-weight: 750; }
.mt-branding .mt-brand-logo-small { width: 56px; }

.mt-widget { display: flex; width: 100%; height: 100vh; height: 100dvh; min-height: 0; margin: 0; flex-direction: column; overflow: hidden; border-radius: 16px; box-shadow: 0 16px 42px rgba(38, 37, 34, .13); }
.mt-embed-body { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: transparent; }
.mt-widget-head { position: relative; flex: 0 0 auto; padding: calc(18px + env(safe-area-inset-top, 0px)) 62px 17px calc(19px + env(safe-area-inset-left, 0px)); background: var(--ink); color: #FFFFFF; }
.mt-widget-head h1 { margin: 0 0 5px; color: #FFFFFF; font-size: 1.08rem; font-weight: 700; line-height: 1.3; }
.mt-widget-head p { margin: 0; color: #E5E0D7; font-size: .86rem; line-height: 1.4; }
.mt-minimize { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 1px solid #FFFFFF55; border-radius: 10px; background: transparent; color: #FFFFFF; touch-action: manipulation; }
.mt-minimize:hover { border-color: var(--accent-bright); background: #FFFFFF12; }
.mt-widget .mt-messages { flex: 1 1 auto; height: auto; min-height: 120px; padding: 16px; background: #FBFAF8; }
.mt-widget .mt-form { flex: 0 0 auto; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.mt-closed-state { flex: 0 0 auto; margin: 0; padding: 12px 16px 4px; color: var(--muted); }
.mt-new-conversation { align-self: flex-start; margin: 8px 16px 12px; }
.mt-empty-state { flex: 0 0 auto; margin: 0; padding: 8px 16px; color: var(--muted); }

@media (max-width: 900px) {
  .mt-dashboard { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 12px; }
  .mt-notification-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .mt-notification-settings > div:first-child { grid-column: 1 / -1; }
  .mt-oncall-list { max-height: 130px; }
}
@media (max-width: 700px) {
  .mt-shell { padding: max(12px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); }
  .mt-header { align-items: flex-start; margin-bottom: 18px; }
  .mt-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .mt-header h1 { font-size: .9rem; }
  .mt-brand-lockup { gap: 10px; }
  .mt-brand-logo { width: 128px; }
  .mt-auth-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 2vh; }
  .mt-workspace-picker { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .mt-settings-card { padding: 16px; }
  .mt-settings-table { min-width: 650px; }
  .mt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mt-stat { min-height: 76px; padding: 12px; }
  .mt-stat strong { font-size: 1.35rem; }
  .mt-notification-settings { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .mt-notification-settings > div:first-child { grid-column: auto; }
  .mt-notification-actions { grid-column: auto; align-items: flex-start; flex-direction: column; gap: 9px; }
  .mt-dashboard { display: flex; flex-direction: column; gap: 12px; }
  .mt-agent-activity { padding: 16px; }
  .mt-activity-head { flex-direction: column; gap: 14px; }
  .mt-activity-controls { width: 100%; justify-content: space-between; gap: 10px; }
  .mt-activity-summary { gap: 7px; margin-top: 15px; }
  .mt-activity-total { padding: 10px; }
  .mt-activity-total strong { font-size: 1.15rem; }
  .mt-activity-total span { font-size: .75rem; }
  .mt-activity-measure { flex: 1 1 150px; justify-content: space-between; }
  .mt-activity-measure select { max-width: 180px; flex: 1 1 auto; }
  .mt-activity-table { min-width: 480px; }
  .mt-list { max-height: 34vh; padding: 5px; }
  .mt-thread { min-height: 68px; padding: 11px; }
  .mt-panel { min-height: 58vh; min-height: 58dvh; }
  .mt-panel-head { padding: 15px; }
  .mt-panel-head .mt-status-select, .mt-assign-label { margin: 4px 5px 4px 0; }
  .mt-assign-label { gap: 5px; }
  .mt-assign-label .mt-status-select { max-width: calc(100vw - 155px); }
  .mt-panel .mt-messages { min-height: 160px; }
  .mt-form { padding: 10px; }
  .mt-form textarea { min-height: 48px; }
  .mt-form button { min-width: 78px; min-height: 48px; padding: 0 12px; }
  input, textarea, select { font-size: 16px; }
  .mt-thread { min-height: 64px; }
}
/* Tablet portrait: keep the inbox list compact above the active conversation. */
@media (min-width: 701px) and (max-width: 1100px) and (orientation: portrait) {
  .mt-shell { padding: 22px; }
  .mt-dashboard { display: flex; flex-direction: column; gap: 14px; }
  .mt-list { max-height: 27dvh; }
  .mt-thread { min-height: 68px; }
  .mt-panel { min-height: 64dvh; }
  .mt-panel .mt-messages { min-height: 180px; }
  .mt-notification-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-notification-settings > div:first-child { grid-column: 1 / -1; }
}
/* Tablet landscape and short phone landscape: preserve side-by-side inbox while reclaiming height. */
@media (min-width: 701px) and (max-width: 1100px) and (orientation: landscape) {
  .mt-shell { padding: 18px; }
  .mt-dashboard { grid-template-columns: minmax(240px, 30vw) minmax(0, 1fr); }
  .mt-panel { min-height: 68dvh; }
  .mt-panel-head { padding: 14px; }
  .mt-messages { padding: 14px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .mt-shell { padding-top: 10px; padding-bottom: 10px; }
  .mt-header { margin-bottom: 12px; padding-bottom: 10px; }
  .mt-panel { min-height: 72dvh; }
  .mt-panel-head { padding-top: 10px; padding-bottom: 10px; }
  .mt-panel .mt-messages { min-height: 100px; }
  .mt-widget-head { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; }
  .mt-widget .mt-messages { min-height: 70px; padding-top: 8px; padding-bottom: 8px; }
  .mt-widget .mt-form { padding-top: 7px; padding-bottom: calc(7px + env(safe-area-inset-bottom, 0px)); }
  .mt-widget .mt-contact { padding-top: 7px; padding-bottom: 7px; }
}
@media (max-width: 420px) {
  .mt-header-divider { display: none; }
  .mt-header h1 { display: none; }
  .mt-form { flex-direction: column; }
  .mt-form button { min-height: 44px; }
  .mt-assign-label { width: 100%; justify-content: space-between; }
  .mt-assign-label .mt-status-select { max-width: none; flex: 1; }
  .mt-message { max-width: 90%; }
  .mt-branding { font-size: .68rem; }
}
@media (hover: none) and (pointer: coarse) {
  button, .mt-status-select { min-height: 44px; }
  .mt-thread { touch-action: manipulation; }
}
.mt-home-card { max-width: 620px; margin: 8vh auto; padding: clamp(24px, 5vw, 44px); }
.mt-home-card .mt-brand-logo { margin-bottom: 24px; }
.mt-home-card p { color: var(--muted); line-height: 1.6; }
.mt-home-card p:last-child { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
