/* Shared control geometry for the authenticated workspace only. */
#appView {
  --control-height: 36px;
  --form-control-height: 42px;
  --control-radius: 8px;
  --control-fill: #302e2b;
  --control-border: #8b8276;
  --control-focus: #f3d1a8;
  --control-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23e0d7ca' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}
html[data-theme="day"] #appView {
  --control-fill: #fff;
  --control-border: #92929b;
  --control-focus: #0066cc;
  --control-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23616169' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}
#appView :where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select),
#appView .check-dropdown-trigger {
  box-sizing: border-box;
  height: var(--control-height);
  min-height: var(--control-height);
  min-width: 0;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background-color: var(--control-fill);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: none;
}
#appView select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: var(--control-arrow);
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
}
#appView :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--control-focus);
  outline-offset: 2px;
  border-color: var(--control-focus);
  box-shadow: none;
}
#appView :is(button, a):focus-visible {
  outline: 2px solid var(--control-focus);
  outline-offset: 3px;
}
#appView :is(input, select):disabled { opacity: .65; cursor: not-allowed; }
#appView :is(.config-action, .compact, .button-link, .admin-remove, .mapping-remove) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  height: var(--control-height);
  padding: 0 12px;
  border-radius: var(--control-radius);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  flex-shrink: 0;
}
#appView .theme-toggle { width: 36px; min-width: 36px; padding: 0; border-radius: 50%; }
#appView .theme-toggle .theme-icon { width: 16px; height: 16px; }
#appView .workspace-account #logoutBtn { height: 36px; min-height: 36px; }
#appView .workspace-account { gap: 12px; }
#appView .workspace-launch {
  border: 1px solid var(--line);
  background: var(--control-fill);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
#appView .workspace-launch:hover { border-color: var(--control-border); background-color: var(--panel-solid); }
#appView .workspace-launch svg { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#appView .workspace-launch .launch-arrow { width: 14px; height: 14px; flex-basis: 14px; color: var(--muted); }
#appView .workspace-header .nav-btn,
#appView .workspace-header .nav-btn:hover,
#appView .workspace-header .nav-btn.active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 88px;
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  transform: none;
  text-decoration: none;
}
/* Labels occupy their own row; dates use the same single field border. */
#appView .filter-module {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px 12px;
  align-items: end;
  background: none;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#appView .filter-module > :is(label, .filter-field) {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
}
#appView .filter-module > :is(label, .filter-field) > span {
  position: static;
  display: block;
  width: auto;
  height: auto;
  padding: 0;
  overflow: visible;
  clip: auto;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  white-space: normal;
}
#appView .filter-module .date-select-wrap,
#appView .filter-module .date-select-wrap:focus-within {
  min-height: 0;
  min-width: 0;
  overflow: visible;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#appView .filter-module .date-select-wrap input[type="text"] {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-fill);
  font-size: 13px;
}
#appView .filter-module > button { justify-self: start; min-width: 80px; }
#appView .check-dropdown-trigger::after { flex: 0 0 7px; }
#appView .check-option { margin: 0; min-height: 36px; line-height: 20px; }
#appView .check-option input { width: 16px; height: 16px; min-height: 16px; padding: 0; flex: 0 0 16px; }
#appView .check-option span { font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
/* Forms share one height across inputs, selects, and their submit action. */
#appView :is(.admin-form, .mapping-form, .organization-chat-dialog-form, .org-points-form) label {
  min-width: 0;
  margin: 0;
  gap: 8px;
  font-size: 12px;
  line-height: 18px;
}
#appView :is(.admin-form, .mapping-form, .organization-chat-dialog-form, .org-points-form) :is(input, select, button) {
  height: var(--form-control-height);
  min-height: var(--form-control-height);
}
#appView :is(.admin-form, .mapping-form) > button { align-self: end; }
#appView .mapping-row > div { min-width: 0; }
#appView .row-actions { gap: 8px; }
#appView .row-actions > :is(select, button, a) { height: var(--control-height); min-height: var(--control-height); }
#appView .row-actions select { min-width: 112px; }
#appView .config-message { color: var(--muted); }
html[data-theme="day"] #appView .config-section-heading { text-shadow: none; }
/* Pagination is a single baseline, including numeric input and page size. */
#appView .page-tools { flex: 0 1 auto; min-width: 0; max-width: 100%; flex-wrap: wrap; align-items: center; row-gap: 10px; }
#appView .page-input { width: 52px; padding: 0 6px; text-align: center; appearance: textfield; }
#appView .page-input::-webkit-inner-spin-button,
#appView .page-input::-webkit-outer-spin-button { appearance: none; margin: 0; }
#appView .page-size-select { width: 112px; min-width: 112px; }
#appView .page-nav { width: var(--control-height); min-width: var(--control-height); padding: 0; }
#appView .page-nav-icon { display: block; margin: 0; }
#appView .pricing-toolbar { align-items: end; gap: 16px; }
#appView .pricing-search-label { margin: 0; }
#appView .pricing-value { margin: 0; }
#appView .pricing-rate-row { align-items: center; }
#appView .modal-actions { align-items: center; flex-wrap: wrap; gap: 8px; }
/* Configuration has compact list states, separate from the media gallery. */
#configView .config-empty,
#configView .org-chat-empty {
  min-height: 0;
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  grid-column: 1 / -1;
}
#configView #organizationList { align-items: start; gap: 12px; }
#configView .organization-card {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  gap: 12px;
  align-content: start;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: none;
}
#configView .organization-row { min-width: 0; align-items: center; gap: 12px 20px; }
#configView .org-title-stack {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  gap: 8px 16px;
  align-items: center;
}
#configView .org-name-link { min-width: 0; max-width: 100%; line-height: 1.6; }
#configView .org-name-link strong { overflow-wrap: anywhere; }
#configView .org-points-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(132px, auto));
  justify-content: start;
  gap: 8px 16px;
  line-height: 1.6;
}
#configView .org-chat-list { min-width: 0; gap: 8px; }
#configView .org-chat-empty {
  padding: 10px 0 0;
  border-top: 1px solid var(--line-soft);
}
#configView .org-chat-row {
  min-height: 52px;
  padding: 8px 10px;
  gap: 12px;
  border-radius: 8px;
  align-items: center;
}
#configView .row-actions > a {
  border: 1px solid var(--line);
  background: var(--control-fill);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
#configView .row-actions > a:hover { border-color: var(--control-border); background: var(--panel-solid); }
#configView .model-supplier-card { min-height: 0; }
#configView .model-supplier-meta { margin-bottom: 16px; }
#configView .model-supplier-title { min-height: 36px; align-items: center; }
#configView .supplier-segment {
  min-height: var(--control-height);
  margin: 0;
  gap: 8px;
  line-height: 20px;
}
#configView .supplier-segment input { width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; }
#configView .supplier-segment span { min-width: 0; overflow-wrap: anywhere; }
#configView .model-save-status { margin-top: 12px; color: var(--muted); }
#configView .pricing-workspace { min-width: 0; align-items: start; }
#configView .pricing-rule-fields { gap: 12px; }
#configView .pricing-value { gap: 8px; line-height: 20px; }
#configView .pricing-extra > summary { min-height: 28px; line-height: 28px; }
#configView .pricing-model-choice { box-shadow: none; }
#configView .pricing-model-choice.active { box-shadow: inset 3px 0 var(--primary); }
@media (max-width: 1100px) {
  #configView .org-title-stack { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  #configView .organization-card { padding: 14px; }
  #configView .organization-card .organization-row { grid-template-columns: minmax(0, 1fr); }
  #configView .organization-card .row-actions { justify-content: flex-start; }
  #configView .org-points-summary { display: flex; flex-wrap: wrap; gap: 6px 16px; }
  #configView .org-chat-row { align-items: stretch; flex-direction: column; }
  #configView .org-chat-row .row-actions { flex-wrap: wrap; }
  #configView .pricing-editor-header { flex-wrap: wrap; }
  #configView .pricing-toolbar { padding-inline: 0; }
}
@media (max-width: 1280px) {
  #appView .filter-module { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #appView .filter-module .date-range-filter { grid-column: span 2; }
  #appView .workspace-account #userLine { max-width: 100px; }
}
@media (max-width: 1000px) {
  #appView .filter-module { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #appView .workspace-account #userLine { display: none; }
  #appView :is(#mappingForm, #chatForm, .password-form) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #appView :is(#mappingForm, #chatForm, .password-form) > button { width: auto; justify-self: start; }
}
@media (max-width: 760px) {
  #appView .workspace-header { min-height: 106px; gap: 8px 12px; }
  #appView .app-main { padding-top: 122px; }
  #appView .workspace-account { gap: 8px; }
  #appView .workspace-brand { gap: 8px; }
  #appView .workspace-brand small { display: none; }
  #appView .workspace-launch { gap: 6px; padding: 0 10px; }
  #appView .workspace-launch > svg:first-child { display: none; }
  #appView .workspace-header .nav-btn,
  #appView .workspace-header .nav-btn:hover,
  #appView .workspace-header .nav-btn.active { flex: 1 1 0; width: auto; min-width: 0; max-width: none; }
  #appView .asset-section-head { align-items: stretch; gap: 14px; }
  #appView .table-tools { min-width: 0; width: 100%; overflow: visible; flex-wrap: wrap; justify-content: flex-start; }
  #appView .page-tools { width: 100%; justify-content: flex-start; white-space: normal; }
  #appView .page-count { flex-basis: 100%; }
  #appView .tool-divider { display: none; }
  #appView .member-row { grid-template-columns: minmax(0, 1fr); }
  #appView .member-row .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  #appView :is(#mappingForm, #chatForm, .password-form) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  #appView .filter-module { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #appView .filter-module input,
  #appView .filter-module select,
  #appView .filter-module .date-select-wrap input[type="text"],
  #appView :is(.mapping-form, .admin-form, .organization-chat-dialog-form) :is(input, select) { font-size: 16px; }
  #appView .organization-config-heading { flex-wrap: wrap; }
}
@media (pointer: coarse) {
  #appView { --control-height: 44px; --form-control-height: 44px; }
  #appView .theme-toggle { width: 44px; min-width: 44px; }
  #appView .workspace-account #logoutBtn { height: 44px; min-height: 44px; }
  #appView .workspace-header .nav-btn,
  #appView .workspace-header .nav-btn:hover,
  #appView .workspace-header .nav-btn.active { height: 44px; min-height: 44px; }
  #appView .check-option { min-height: 44px; }
}
@media (pointer: coarse) and (max-width: 760px) {
  #appView .workspace-header { min-height: 122px; }
  #appView .app-main { padding-top: 138px; }
}
@media (forced-colors: active) {
  #appView select { appearance: auto; background-image: none; }
  #appView :is(input, select, button, .workspace-launch) { border: 1px solid ButtonText; }
}
