/* Shared interactive controls. Loaded after page styles, including auth pages. */
body { --control-radius: 10px; --control-ring: 0 0 0 3px #0d948824; }
body :is(.btn, .add-btn, .quick-add-btn, .action-btn) {
  --control-bg: #fff; --control-fg: #475569; --control-border: #d7e1e9;
  --control-hover: #f1f5f9; --control-hover-border: #a8bac9;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 16px; border: 1px solid var(--control-border);
  border-radius: var(--control-radius); background: var(--control-bg); color: var(--control-fg);
  font-size: 14px; font-weight: 600; line-height: 1.4; text-decoration: none;
  vertical-align: middle; cursor: pointer; box-shadow: 0 1px 2px #0f172a06;
  transition: background-color 160ms, border-color 160ms, box-shadow 160ms, transform 160ms;
}
body :is(.btn-primary, .btn-login, .btn-register, .add-btn, .quick-add-btn, .qr-login-btn) {
  --control-bg: #0d8479; --control-fg: #fff; --control-border: #0d8479;
  --control-hover: #096a62; --control-hover-border: #096a62;
  background-image: linear-gradient(180deg, #ffffff0a, transparent);
  box-shadow: inset 0 1px 0 #ffffff1f, 0 2px 3px #0d847915;
}
body :is(.btn-success, .btn-outline-success) {
  --control-bg: #eef9f3; --control-fg: #18764b; --control-border: #c8e8d5;
  --control-hover: #dbf2e4; --control-hover-border: #96cfae;
}
body .btn-outline-primary {
  --control-bg: #eef9f7; --control-fg: #0c766c; --control-border: #bfe2dc;
  --control-hover: #d9f1ec; --control-hover-border: #8dcac0;
}
body :is(.btn-warning, .btn-outline-warning) {
  --control-bg: #fff8e9; --control-fg: #95600e; --control-border: #f1ddb2;
  --control-hover: #fff0cb; --control-hover-border: #dfbc75;
}
body :is(.btn-info, .btn-outline-info) {
  --control-bg: #eff6ff; --control-fg: #3666a1; --control-border: #cddff4;
  --control-hover: #e0edfd; --control-hover-border: #a9c6e9;
}
body .btn-danger {
  --control-bg: #c83d49; --control-fg: #fff; --control-border: #c83d49;
  --control-hover: #ab2d38; --control-hover-border: #ab2d38;
}
body :is(.btn-outline-danger, .delete-btn) {
  --control-bg: #fff4f4; --control-fg: #c13645; --control-border: #f0cbd0;
  --control-hover: #ffe5e8; --control-hover-border: #e7a3ac;
}
body .btn-secondary { --control-bg: #526174; --control-fg: #fff; --control-border: #526174; --control-hover: #3d4b5e; }
body .btn-link { --control-bg: transparent; --control-fg: #0c766c; --control-border: transparent; box-shadow: none; }
body :is(.btn, .add-btn, .quick-add-btn, .action-btn):hover {
  background-color: var(--control-hover); border-color: var(--control-hover-border); color: var(--control-fg);
  transform: translateY(-1px); box-shadow: 0 3px 7px #0f172a0c;
}
body :is(.btn, .add-btn, .quick-add-btn, .action-btn):focus-visible {
  outline: 2px solid #0d8479; outline-offset: 3px; box-shadow: var(--control-ring);
}
body :is(.btn, .add-btn, .quick-add-btn, .action-btn):active {
  background-color: var(--control-hover); color: var(--control-fg); transform: translateY(0); box-shadow: inset 0 1px 3px #0f172a12;
}
body :is(.btn, .add-btn, .quick-add-btn, .action-btn):is(:disabled, .disabled, [aria-disabled="true"]) {
  opacity: .48; cursor: not-allowed; transform: none; box-shadow: none;
}
body .btn-sm { min-height: 34px; padding: 7px 11px; font-size: 13px; }
body .btn-lg { min-height: 48px; padding: 12px 22px; font-size: 15px; }
body :is(.btn, .add-btn, .quick-add-btn, .action-btn) :is(.bi, i) { font-size: 16px; line-height: 1; margin: 0 !important; opacity: 1; flex-shrink: 0; }
body .btn .spinner-border { width: 16px; height: 16px; }
body .ui-icon-button { width: 34px; min-width: 34px; padding: 7px; flex: 0 0 auto; }
body .btn-group:not(.login-tabs .btn-group) { display: inline-flex; flex-wrap: wrap; flex-direction: row; gap: 6px; vertical-align: middle; }
body .btn-group:not(.login-tabs .btn-group) > .btn { border-radius: 9px !important; margin: 0 !important; border-width: 1px !important; flex: 0 1 auto; }
body .input-group > .btn { border-radius: 0 10px 10px 0; }
body :is(.form-control, select, .input-field input) {
  min-height: 42px; border: 1px solid #d7e1e9; border-radius: 10px; background-color: #fff;
  color: var(--text-main); font-size: 14px; padding: 10px 13px;
  transition: border-color 160ms, box-shadow 160ms, background-color 160ms;
}
body :is(.form-control, select, .input-field input):hover:not(:disabled) { border-color: #a8bfc5; }
body :is(.form-control, select, .input-field input):focus { transform: none; outline: none; border-color: #0d9488; box-shadow: var(--control-ring); }
body :is(.form-control, select):disabled { background-color: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
body .form-control::placeholder, body .input-field input::placeholder { color: #94a3b8; }
body .form-control-sm { min-height: 34px; padding: 7px 11px; font-size: 13px; }
body textarea.form-control { min-height: 96px; }
body .form-label { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 8px; }
body .form-check-input { cursor: pointer; border-color: #b8c8d2; }
body .form-check-input:checked { background-color: #0d8479; border-color: #0d8479; }
body .form-check-input:focus { border-color: #0d9488; box-shadow: var(--control-ring); }
body .status-toggle input:focus-visible + .status-slider { outline: 2px solid #0d8479; outline-offset: 3px; }
body .status-slider { background-color: #cbd5e1; transition: background-color 160ms; }
body input:checked + .status-slider { background-color: #0d9488; }
body .status-slider:before { box-shadow: 0 1px 3px #0f172a26; }
body .status-toggle input:disabled + .status-slider { opacity: .45; cursor: not-allowed; }

/* Native selects retain values, validation, names, and existing business events. */
.ui-select { position: relative; display: inline-flex; flex-direction: column; width: 100%; min-width: 0; max-width: 100%; vertical-align: middle; }
body select.ui-select-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; min-width: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
body .ui-select-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 42px;
  border: 1px solid #d7e1e9; border-radius: 10px; padding: 10px 12px 10px 14px;
  background: linear-gradient(180deg, #fff, #f8fbfc); color: #334155; text-align: left; font: inherit; font-size: 14px; line-height: 1.45;
  cursor: pointer; box-shadow: 0 1px 2px #0f172a04; transition: border-color 160ms, box-shadow 160ms, background-color 160ms;
}
.ui-select-value { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ui-select-chevron { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; border-radius: 6px; color: #64827e; background: #eaf3f1; transition: transform 160ms; font-size: 11px; }
body .ui-select-trigger:hover:not(:disabled) { border-color: #86bcb3; box-shadow: 0 2px 5px #0d84790a; }
body .ui-select-trigger:is(:focus-visible, [aria-expanded="true"]) { border-color: #0d9488; outline: 0; box-shadow: var(--control-ring); }
.ui-select-trigger[aria-expanded="true"] .ui-select-chevron { transform: rotate(180deg); }
body .ui-select-trigger:disabled { background: #f1f5f9; color: #94a3b8; opacity: .7; cursor: not-allowed; }
.ui-select-trigger[aria-invalid="true"] { border-color: #c13645; }
.ui-select-validation { margin-top: 5px; color: #c13645; font-size: 12px; line-height: 1.5; }
.ui-select.is-small .ui-select-trigger { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.ui-select.is-placeholder .ui-select-value { color: #718497; }
.ui-select-popup {
  position: fixed; z-index: 1085; padding: 6px; border: 1px solid #dce8e5; border-radius: 12px;
  background: #fff; box-shadow: 0 12px 36px #173a3426, 0 3px 8px #0f172a08; color: #334155;
  max-width: calc(100vw - 16px); font-size: 14px; animation: select-in 120ms ease-out;
}
.ui-select-search-row { display: flex; align-items: center; gap: 8px; padding: 5px 9px 10px; border-bottom: 1px solid #eef3f2; margin-bottom: 5px; color: #6b8681; }
body .ui-select-search { min-width: 0; width: 100%; min-height: 32px; padding: 4px 0; border: 0; background: transparent; border-radius: 0; outline: none; box-shadow: none; font: inherit; font-size: 14px; }
.ui-select-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c3d9d3 transparent; max-height: 260px; outline: none; }
.ui-select-option { display: flex; align-items: center; gap: 12px; padding: 10px 11px; min-height: 40px; border-radius: 7px; cursor: pointer; line-height: 1.45; overflow-wrap: anywhere; }
.ui-select-option > span { flex: 1; min-width: 0; }
.ui-select-option i { font-size: 15px; color: #0d8479; flex-shrink: 0; }
.ui-select-option[aria-selected="true"] { color: #0b776d; font-weight: 600; background: #edf8f5; }
.ui-select-option.is-active { background: #e5f3ef; box-shadow: inset 0 0 0 1px #b8dfd4; }
.ui-select-option[aria-disabled="true"] { color: #a2afb9; cursor: not-allowed; background: transparent; box-shadow: none; }
.ui-select-group { padding: 10px 11px 5px; color: #7b8d9a; font-size: 12px; font-weight: 600; }
.ui-select-empty { padding: 22px 12px; color: #7b8d9a; text-align: center; }
.ui-select-hint { margin: 5px -6px -6px; padding: 8px 12px; border-top: 1px solid #eef3f2; border-radius: 0 0 12px 12px; background: #f8fbfa; font-size: 11px; color: #81958e; }
.ui-control-tooltip { position: fixed; z-index: 1090; max-width: 240px; padding: 7px 10px; border-radius: 7px; background: #243d3a; color: #fff; box-shadow: 0 3px 10px #0f172a18; font-size: 12px; line-height: 1.5; pointer-events: none; }
.dashboard-table-header .ui-select { width: 180px; }
.pagination-controls .ui-select { width: 84px; }
.input-group > .ui-select { flex: 1 1 0; width: 1%; }
.input-group > .ui-select .ui-select-trigger { border-radius: 10px 0 0 10px; }

/* Repair oversized/inconsistent controls in account and keyword screens. */
body .account-selector { border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: 12px; padding: 24px; }
body .selector-header { margin-bottom: 20px; gap: 12px; }
body .selector-icon { width: 40px; height: 40px; background: #edf8f5; color: #0d8479; border: 1px solid #d6ece5; border-radius: 11px; font-size: 20px; }
body .selector-title { font-size: 18px; margin-bottom: 5px; }
body .selector-subtitle { font-size: 13px; }
body .account-selector .btn { min-height: 42px; padding: 10px 18px !important; }
body .keyword-container { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
body .keyword-header { background: #f0f8f6; border-bottom: 1px solid #dcece6; color: #194e46; padding: 18px 24px; gap: 14px; flex-wrap: wrap; }
body .keyword-header h3 { font-size: 18px; }
body .keyword-header > .d-flex { flex-wrap: wrap; }
body .keyword-header .account-badge { background: #fff; color: #4e7266; border: 1px solid #d6e9df; padding: 6px 10px; font-size: 12px; }
body .keyword-header .account-badge:not(:has(.badge)) { display: none; }
body .keyword-input-area { padding: 24px; background: #fbfcfd; }
body .keyword-input-group { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.keyword-input-group .input-field { flex: 1 1 180px; min-width: 0; }
.keyword-input-group .input-field:nth-child(2) { flex-grow: 1.5; flex-basis: 240px; }
.keyword-input-group .input-field:nth-child(3) { flex-grow: 1.3; flex-basis: 230px; }
body .input-field label { display: block; position: static; background: transparent; color: #64748b; font-size: 12px; padding: 0; margin-bottom: 8px; }
body .input-field input { width: 100%; min-height: 42px; padding: 10px 13px; }
body .keyword-input-group .add-btn { min-height: 42px; padding: 10px 16px; }
body .keyword-input-group .btn-image { margin: 0; background: #eef9f7 !important; border: 1px solid #bfe2dc !important; color: #0c766c; }
body .keyword-input-group .btn-image:hover { background: #d9f1ec !important; border-color: #8dcac0 !important; }
body .keywords-list { padding: 24px; }
body .empty-state { padding: 44px 20px; }
body .empty-state > i { display: inline-flex; align-items: center; justify-content: center; width: 68px; height: 68px; font-size: 32px; margin-bottom: 18px; border-radius: 20px; background: #edf8f5; color: #439b8c; opacity: 1; }
body .empty-state h3 { font-size: 20px; font-weight: 600; }
body .empty-state p { margin-bottom: 22px; color: #7a8b9b; }
body .empty-state :is(button, a) i { font-size: 16px; margin: 0 !important; opacity: 1; }
body .qr-login-btn::before { display: none; }
body :is(.qr-login-btn, .manual-input-btn) { display: flex; justify-content: flex-start; gap: 14px; padding: 18px 22px; text-align: left; min-height: 82px; flex-basis: 280px; }
body :is(.qr-login-btn, .manual-input-btn) > .bi { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 23px; background: #ffffff24; }
body .manual-input-btn > .bi { color: #0d8479; background: #edf8f5; }
.account-method-copy { display: grid; gap: 4px; }
.account-method-copy strong { font-size: 16px; }
.account-method-copy small { font-size: 12px; font-weight: 400; opacity: .8; }
body .qr-login-btn:hover { background-image: none; }
body.auth-page .btn-login, body.auth-page .btn-register { color: #fff; background: #0d8479; border-color: #0d8479; }
body.auth-page .btn:is(.btn-login, .btn-register):hover { background: #096a62; border-color: #096a62; }
body .login-tabs .btn-group { gap: 4px; padding: 4px; border: 1px solid #e2ebe8; border-radius: 12px; background: #f2f7f5; }
body .login-tabs .btn { border: 0; border-radius: 8px !important; background: transparent; color: #70837d; font-size: 12px; min-height: 38px; padding: 8px 6px; margin: 0 !important; box-shadow: none; }
body .login-tabs .btn-check:checked + .btn { background: #fff; color: #0d8479; border: 0; box-shadow: 0 1px 4px #153c2e12; }
/* Keep account actions as one readable row instead of a squeezed icon grid. */
#cookieTable { min-width: 1280px; }
#cookieTable th { white-space: nowrap; }
#cookieTable :is(th, td):last-child { min-width: 216px; position: sticky; right: 0; background: #fff; box-shadow: -5px 0 10px #0f172a05; }
#cookieTable th:last-child { background: #f8fafc; z-index: 11; }
#cookieTable .btn-group { flex-wrap: nowrap; }
#cookieTable :is(.remark-display, .pause-duration-display) { white-space: nowrap; }
body .modal .modal-header { background: #fff; color: #25453f; border-bottom: 1px solid #e2ebe8; padding: 20px 24px; }
body .modal .modal-title { font-size: 18px; font-weight: 600; }
body .modal .card { border: 1px solid #e2ebe8; box-shadow: none; border-radius: 12px; backdrop-filter: none; }
body .modal .card:hover { transform: none; box-shadow: none; }
body .modal .card-header { background: #f0f8f6; color: #29564b; padding: 16px 20px; border-bottom: 1px solid #dcece6; border-radius: 12px 12px 0 0 !important; }
body .modal .modal-footer { gap: 8px; border-color: #e2ebe8; }
@keyframes select-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 767px) {
  body :is(.btn, .add-btn, .quick-add-btn, .action-btn) { min-height: 44px; }
  body .ui-icon-button { width: 44px; min-width: 44px; }
  body .ui-select-trigger, .ui-select.is-small .ui-select-trigger { min-height: 44px; }
  body .ui-select-option { min-height: 44px; }
  body .account-selector, body .keyword-input-area, body .keywords-list { padding: 18px; }
  body .keyword-header { padding: 18px; }
  body .keyword-input-group { flex-direction: row; }
  .keyword-input-group .input-field, .keyword-input-group .input-field:nth-child(n) { flex: 1 1 100%; }
  body .keyword-input-group .add-btn { flex: 1 1 100%; margin: 0; }
  body :is(.qr-login-btn, .manual-input-btn) { width: 100%; max-width: none !important; flex-basis: auto; }
  body .card-header.d-flex { flex-wrap: wrap; gap: 12px; }
  #cookieTable :is(th, td):last-child { position: static; box-shadow: none; }
  .ui-select-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body :is(.btn, .add-btn, .quick-add-btn, .action-btn):is(:hover, :active) { transform: none; }
  .ui-select-popup { animation: none; }
}
