/* TooClose STEP 9G-G-3 - Gemini settings Desktop-Parity UI */

.tcai-settings {
    width: min(100%, 1220px);
    margin: 0 auto;
    color: #242424;
}

.tcai-settings *,
.tcai-settings *::before,
.tcai-settings *::after {
    box-sizing: border-box;
}

.tcai-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 16px;
    padding: 18px 20px;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(219,245,255,.96), rgba(255,240,247,.94) 55%, rgba(255,249,231,.96));
    box-shadow: 0 8px 26px rgba(0,0,0,.035);
}

.tcai-page-head h1 {
    margin: 2px 0 7px;
    font-size: 28px;
}

.tcai-page-head p {
    margin: 0;
    line-height: 1.65;
}

.tcai-kicker {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    opacity: .62;
}

.tcai-head-status {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.tcai-user-chip,
.tcai-mode-chip {
    min-width: 130px;
    padding: 9px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(0,0,0,.055);
    text-align: center;
}

.tcai-mode-chip.is-custom {
    background: linear-gradient(135deg, rgba(244,232,255,.95), rgba(255,236,247,.95));
}

.tcai-user-chip span,
.tcai-mode-chip span {
    display: block;
    font-size: 11px;
    color: #6b6b6b;
}

.tcai-user-chip strong,
.tcai-mode-chip strong {
    display: block;
    margin-top: 3px;
    font-size: 15px;
}

.tcai-notice {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-weight: 800;
}

.tcai-notice.is-success { background: rgba(228,250,236,.96); border: 1px solid rgba(38,151,82,.18); }
.tcai-notice.is-warning { background: rgba(255,246,222,.96); border: 1px solid rgba(187,126,0,.18); }
.tcai-notice.is-error { background: rgba(255,235,235,.96); border: 1px solid rgba(188,42,42,.18); }

.tcai-card {
    margin: 0 0 14px;
    padding: 18px;
    border: 1px solid rgba(0,0,0,.085);
    border-radius: 18px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 8px 26px rgba(0,0,0,.035);
}

.tcai-standard-card {
    background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,252,255,.97));
}

.tcai-custom-card {
    background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(253,248,255,.97));
    border-color: rgba(127,94,160,.13);
}

.tcai-custom-card.is-active-mode {
    border-color: rgba(176,91,164,.34);
    box-shadow: 0 10px 30px rgba(145,76,142,.08);
}

.tcai-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
}

.tcai-card h2,
.tcai-card h3 {
    margin: 0;
}

.tcai-card-head p {
    margin: 4px 0 0;
    color: #666;
    line-height: 1.5;
}

.tcai-status-pill {
    flex: 0 0 auto;
    padding: 6px 11px;
    border-radius: 999px;
    background: #f1f1f1;
    font-size: 13px;
    font-weight: 900;
}

.tcai-status-pill.is-ok { background: rgba(222,249,231,.96); color: #176d38; }
.tcai-status-pill.is-active-mode { background: linear-gradient(90deg, #d9efff, #ffe3ee); color: #5a3350; }

.tcai-overview-card { padding: 12px; }
.tcai-overview-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.tcai-overview-grid > div {
    min-height: 76px;
    padding: 10px 11px;
    border-radius: 13px;
    background: linear-gradient(145deg, #f8fafc, #fff);
    border: 1px solid rgba(0,0,0,.055);
}

.tcai-overview-grid span,
.tcai-overview-grid strong,
.tcai-overview-grid small {
    display: block;
}

.tcai-overview-grid span { font-size: 11px; color: #707070; }
.tcai-overview-grid strong { margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
.tcai-overview-grid small { margin-top: 3px; color: #777; }

.tcai-toggle-grid { display: grid; gap: 8px; margin-bottom: 14px; }

.tcai-toggle-row,
.tcai-custom-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 12px;
    border: 1px solid rgba(0,0,0,.07);
    border-radius: 13px;
    background: #fcfcfc;
}

.tcai-toggle-row.is-disabled { opacity: .58; }
.tcai-toggle-row strong,
.tcai-toggle-row small,
.tcai-custom-toggle-row strong,
.tcai-custom-toggle-row small { display: block; }
.tcai-toggle-row small,
.tcai-custom-toggle-row small { color: #6d6d6d; margin-top: 2px; }

.tcai-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.tcai-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tcai-switch > span {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #c8c8c8;
    transition: .18s ease;
    cursor: pointer;
}
.tcai-switch-lg > span { width: 52px; height: 28px; }
.tcai-switch > span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,.24);
    transition: .18s ease;
}
.tcai-switch-lg > span::after { width: 22px; height: 22px; }
.tcai-switch input:checked + span { background: linear-gradient(90deg, #72b9ff, #f28db5); }
.tcai-switch input:checked + span::after { transform: translateX(20px); }
.tcai-switch-lg input:checked + span::after { transform: translateX(24px); }
.tcai-switch input:disabled + span { cursor: not-allowed; opacity: .65; }

.tcai-credential-block {
    margin: 12px 0;
    padding: 14px;
    border: 1px solid rgba(0,0,0,.075);
    border-radius: 15px;
    background: rgba(255,255,255,.88);
    transition: .18s ease;
}
.tcai-credential-block.is-locked {
    background: repeating-linear-gradient(135deg, rgba(247,247,248,.95), rgba(247,247,248,.95) 12px, rgba(243,243,245,.95) 12px, rgba(243,243,245,.95) 24px);
}
.tcai-credential-block.is-locked input { cursor: not-allowed; color: #777; }

.tcai-credential-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}
.tcai-credential-head strong,
.tcai-credential-head small { display: block; }
.tcai-credential-head small { color: #777; margin-top: 2px; }

.tcai-grid-two { display: grid; grid-template-columns: 1fr 1.45fr; gap: 12px; }
.tcai-field { display: flex; flex-direction: column; gap: 6px; }
.tcai-field > span { font-weight: 900; }
.tcai-field small { color: #6d6d6d; }

.tcai-field input[type="text"],
.tcai-field input[type="password"],
.tcai-field input[type="number"],
.tcai-remaining-field input[type="number"] {
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid rgba(0,0,0,.14);
    border-radius: 12px;
    background: #fff;
    color: #222;
    outline: none;
}
.tcai-field input:focus,
.tcai-remaining-field input:focus { border-color: rgba(87,137,218,.58); box-shadow: 0 0 0 3px rgba(106,151,226,.10); }
.tcai-field input.is-invalid { border-color: #c65353; box-shadow: 0 0 0 3px rgba(198,83,83,.09); }

.tcai-status-lines { display: grid; gap: 7px; margin: 12px 0; }
.tcai-status-lines > div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(248,249,251,.95);
}
.tcai-status-lines span { color: #666; font-weight: 800; }
.tcai-status-lines small { grid-column: 2; color: #777; }

.tcai-search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(238,248,255,.95), rgba(255,245,250,.95));
}
.tcai-check-line { display: flex; gap: 8px; align-items: center; font-weight: 800; }
.tcai-search-status { flex: 0 0 auto; color: #666; font-size: 13px; }

.tcai-toolbar-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.tcai-connection-slot { flex: 1 1 auto; min-width: 0; }
.tcai-toolbar-buttons { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 2px; }

.tcai-tip-box,
.tcai-custom-notice,
.tcai-custom-runtime,
.tcai-security-note {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f7f8fa;
    color: #5e5e5e;
    font-size: 13px;
    line-height: 1.65;
}
.tcai-tip-box { margin-top: 12px; }
.tcai-custom-notice { margin: 10px 0 12px; background: linear-gradient(90deg, #f7f2ff, #fff4f8); }
.tcai-custom-runtime { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 5px 16px; }
.tcai-custom-runtime strong { width: 100%; color: #444; }
.tcai-security-footer { margin-top: 12px; background: linear-gradient(90deg, #eef8ff, #fff2f7); font-weight: 800; }

.tcai-custom-priority {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: start;
    margin: 12px 0 9px;
    padding: 9px 10px;
    border-radius: 11px;
    background: #faf8fc;
}
.tcai-custom-priority span { color: #666; font-weight: 800; }

.tcai-model-table { overflow: hidden; border: 1px solid rgba(0,0,0,.08); border-radius: 14px; }
.tcai-model-head,
.tcai-model-row {
    display: grid;
    grid-template-columns: 66px minmax(250px, 1fr) 72px minmax(210px, .8fr);
    gap: 10px;
    align-items: center;
}
.tcai-model-head { padding: 9px 12px; background: #f5f6f8; font-size: 12px; font-weight: 900; }
.tcai-model-row { padding: 10px 12px; border-top: 1px solid rgba(0,0,0,.06); }
.tcai-model-row.is-blocked { background: rgba(255,240,240,.7); }
.tcai-model-name strong,
.tcai-model-name small,
.tcai-model-state strong,
.tcai-model-state small,
.tcai-remaining-field small { display: block; }
.tcai-model-name small,
.tcai-model-state small,
.tcai-remaining-field small { color: #777; }
.tcai-order-chip {
    width: 34px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #f2f4f7;
    font-weight: 900;
}
.tcai-model-state { padding: 7px 9px; border-radius: 10px; background: #f7f8f9; }
.tcai-model-state.is-ok strong { color: #237244; }
.tcai-model-state.is-stop strong { color: #a33030; }
.tcai-remaining-field { display: grid; grid-template-columns: 100px 1fr; gap: 8px; align-items: center; }
.tcai-remaining-field input { text-align: center; }

.tcai-runtime-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.tcai-runtime-grid > div { padding: 11px; border-radius: 12px; background: #f8f8fa; }
.tcai-runtime-grid span,
.tcai-runtime-grid strong { display: block; }
.tcai-runtime-grid span { font-size: 12px; color: #666; }

.tcai-actions,
.tcai-delete-bar { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin: 16px 0; }

.tcai-primary-btn,
.tcai-secondary-btn,
.tcai-danger-btn,
.tcai-test-btn {
    min-height: 42px;
    padding: 9px 15px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
}
.tcai-primary-btn { border: 1px solid rgba(64,118,208,.18); background: linear-gradient(90deg, #cfe8ff, #fde7ef); color: #111; }
.tcai-secondary-btn { border: 1px solid rgba(0,0,0,.10); background: #f7f8fa; color: #333; }
.tcai-danger-btn { border: 1px solid rgba(179,45,45,.18); background: #fff4f4; color: #9c2727; }
.tcai-primary-btn:hover,
.tcai-secondary-btn:hover,
.tcai-danger-btn:hover,
.tcai-test-btn:hover { filter: brightness(.985); }

.tcai-hidden-form { display: none; }

.tcai-custom-dialog {
    width: min(92vw, 560px);
    border: 0;
    border-radius: 18px;
    padding: 0;
    box-shadow: 0 24px 80px rgba(0,0,0,.22);
}
.tcai-custom-dialog::backdrop { background: rgba(20,22,28,.36); backdrop-filter: blur(2px); }
.tcai-custom-dialog-inner { padding: 18px; }
.tcai-dialog-title { font-size: 20px; font-weight: 900; margin-bottom: 5px; }
.tcai-custom-dialog p { margin: 0 0 13px; color: #666; line-height: 1.55; }
.tcai-custom-dialog .tcai-field { margin-top: 10px; }
.tcai-dialog-error { min-height: 22px; margin-top: 8px; color: #a52d2d; font-weight: 800; }
.tcai-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.tcai-login-required,
.tcai-error { padding: 18px; border-radius: 14px; background: #fff5f5; border: 1px solid rgba(180,50,50,.18); }

@media (max-width: 980px) {
    .tcai-overview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .tcai-runtime-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .tcai-page-head,
    .tcai-toolbar-row,
    .tcai-search-row { flex-direction: column; }
    .tcai-head-status { width: 100%; }
    .tcai-user-chip,
    .tcai-mode-chip { flex: 1 1 0; }
    .tcai-grid-two,
    .tcai-runtime-grid,
    .tcai-overview-grid { grid-template-columns: 1fr; }
    .tcai-status-lines > div,
    .tcai-custom-priority { grid-template-columns: 1fr; }
    .tcai-status-lines small { grid-column: 1; }
    .tcai-toolbar-buttons { width: 100%; }
    .tcai-toolbar-buttons button { flex: 1 1 180px; }
    .tcai-model-head { display: none; }
    .tcai-model-row { grid-template-columns: 54px 1fr; align-items: start; }
    .tcai-order-chip { grid-column: 2; }
    .tcai-model-state,
    .tcai-remaining-field { grid-column: 2; }
}
