/* HydroLoop — диалоговые окна, авторизация, Git/WebDAV и иконки Feather v4.29.0 */

.fe-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

dialog {
  width: min(760px, calc(100vw - 30px));
  border: 1px solid var(--line, #2a4656);
  border-radius: 20px;
  padding: 24px;
  color: var(--text);
  background: var(--panel, #0b1720);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}

dialog::backdrop {
  background: rgba(0, 7, 12, 0.75);
  backdrop-filter: blur(5px);
}

.dialog-heading { margin-bottom: 16px; }
.method-dialog { width: min(940px, calc(100vw - 24px)); max-height: 88vh; overflow-y: auto; padding: 22px; }
.method-dialog-body { display: flex; flex-direction: column; gap: 18px; }
.method-nav-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line-soft); position: sticky; top: -10px; z-index: 10; backdrop-filter: blur(8px); }
.method-filter-pill { padding: 7px 12px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s ease; }
.method-filter-pill:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.method-filter-pill.active { background: var(--cyan); color: #041118; border-color: var(--cyan); font-weight: 700; }
.method-lead { padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(53, 215, 227, 0.28); background: rgba(53, 215, 227, 0.07); color: var(--text); font-size: 0.82rem; line-height: 1.5; }
.method-section { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.method-sec-header { display: flex; flex-direction: column; gap: 3px; }
.method-sec-num { font: 700 0.68rem var(--mono); color: var(--cyan); letter-spacing: 0.06em; }
.method-sec-header h3 { margin: 0; font-size: 1.02rem; color: var(--text); }
.method-sec-desc { margin: 0; font-size: 0.81rem; color: var(--muted); line-height: 1.48; }
.method-cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.method-card { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--bg-soft); display: flex; flex-direction: column; gap: 8px; }
.method-card-tag { font: 600 0.68rem var(--mono); color: var(--cyan); text-transform: uppercase; letter-spacing: 0.04em; }
.method-card h4 { margin: 0; font-size: 0.9rem; color: var(--text); }
.method-list { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--muted); line-height: 1.46; }
.method-list strong { color: var(--text); }
.method-list code { font-family: var(--mono); font-size: 0.72rem; padding: 1px 5px; border-radius: 4px; background: rgba(53, 215, 227, 0.12); color: var(--cyan); }
.method-formula-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.method-formula-box { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--bg-soft); display: flex; flex-direction: column; gap: 6px; }
.formula-title { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.method-formula-box code { display: block; padding: 6px 10px; border-radius: 6px; background: rgba(4, 12, 18, 0.65); border: 1px solid var(--line-soft); font-family: var(--mono); font-size: 0.74rem; color: var(--cyan); overflow-x: auto; }
.method-formula-box p, .limitations p { margin: 0; color: var(--muted); font-size: 0.77rem; line-height: 1.45; }
.limitations { margin-top: 6px; padding: 14px 16px; border-radius: 10px; border-left: 3px solid var(--orange); background: rgba(255, 158, 67, 0.07); }
.limitations h3 { margin: 0 0 5px; font-size: 0.88rem; color: var(--text); }
@media (max-width: 720px) {
  .method-dialog { padding: 14px; width: calc(100vw - 16px); }
  .method-cards-grid, .method-formula-grid { grid-template-columns: 1fr; }
  .method-nav-bar { position: static; }
}

.loading .calculate-button .button-label::after { content: "…"; }
.loading .results-panel { opacity: 0.62; }
.error-banner { width: 100%; padding: 12px 14px; border: 1px solid rgba(255, 107, 104, 0.35); border-radius: 10px; color: #ffd0ce; background: rgba(255, 107, 104, 0.08); font-size: 0.78rem; }

/* Диалог Git и подключение папки /HydroLoop */
.git-dialog { max-width: 720px; width: min(720px, calc(100vw - 24px)); max-height: 88vh; overflow-y: auto; }
.git-dialog-body { display: flex; flex-direction: column; gap: 14px; }
.git-status-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: rgba(30, 166, 114, 0.1); border: 1px solid rgba(30, 166, 114, 0.3); font-size: 0.8rem; color: #7fe6ba; }
.git-changes-section h3, .git-history-section h3 { margin: 0 0 8px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.git-file-list { margin: 0; padding-left: 18px; max-height: 100px; overflow-y: auto; font-family: var(--mono); font-size: 0.75rem; color: #ffca64; }
.git-clean { margin: 0; font-size: 0.8rem; color: var(--green); }
.git-commit-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel); }
.git-form-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.git-submit-button { width: auto; padding: 0 20px; height: 40px; font-size: 0.82rem; }
.git-feedback { font-size: 0.8rem; font-weight: 500; }
.git-feedback.success { color: var(--green); }
.git-feedback.error { color: var(--red); }
.git-history-list { display: flex; flex-direction: column; gap: 8px; max-height: 150px; overflow-y: auto; }
.git-history-item { padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg-soft); }
.git-hist-header { display: flex; gap: 10px; font-size: 0.72rem; color: var(--faint); font-family: var(--mono); margin-bottom: 3px; }
.git-hash { color: var(--cyan); font-weight: 600; }
.git-author { color: var(--text); }
.git-hist-msg { margin: 0; font-size: 0.78rem; color: #d0e0ec; }
.git-user-badge { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 10px; background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.25); }
.git-user-badge .user-meta { display: flex; align-items: center; gap: 10px; }
.git-user-badge .user-icon { display: inline-flex; color: var(--cyan); font-size: 1.15rem; }
.git-user-badge strong { display: block; font-size: 0.85rem; color: #bae6fd; }
.git-user-badge small { color: var(--faint); font-family: var(--mono); font-size: 0.72rem; }
.small-link-btn { background: none; border: 0; color: var(--cyan); font-size: 0.75rem; text-decoration: underline; cursor: pointer; padding: 4px 8px; }
.small-link-btn:hover { color: #fff; }
.git-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--muted); cursor: pointer; user-select: none; }
.git-checkbox-row input { accent-color: var(--blue); cursor: pointer; }

.git-conn-guide { font-size: 0.81rem; line-height: 1.48; padding-top: 10px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.git-conn-guide p { margin: 0; }
.git-conn-guide a { color: var(--cyan); }
.git-conn-guide code { color: #bae6fd; background: rgba(5, 15, 23, 0.85); padding: 2px 6px; border-radius: 5px; font-family: var(--mono); font-size: 0.74rem; word-break: break-all; }
.git-conn-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.git-conn-code-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.git-copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 5px; border: 1px solid rgba(53, 215, 227, 0.35); background: rgba(53, 215, 227, 0.1); color: var(--cyan); font-size: 0.7rem; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.git-copy-btn:hover { background: rgba(53, 215, 227, 0.22); color: #fff; }

/* Логотип Вибрации и профиль в шапке */
.brand-logo { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.4)); flex-shrink: 0; }
.user-auth-nav { position: relative; display: flex; align-items: center; }
.login-nav-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(99, 102, 241, 0.12); border-color: rgba(99, 102, 241, 0.4); color: #c7d2fe; }
.login-nav-btn:hover { background: rgba(99, 102, 241, 0.22); border-color: rgba(99, 102, 241, 0.7); color: #fff; }
.user-profile-pill { position: relative; display: flex; align-items: center; }
.user-pill-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(99, 102, 241, 0.35); background: rgba(19, 27, 43, 0.85); color: #e2e8f0; font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.user-pill-btn:hover { background: rgba(99, 102, 241, 0.18); border-color: rgba(99, 102, 241, 0.6); }
.user-pill-avatar { display: inline-flex; font-size: 0.9rem; color: #a5b4fc; }
.user-pill-caret { font-size: 0.7rem; opacity: 0.7; }
.user-dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 226px; background: #101625; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px; padding: 8px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55); display: none; flex-direction: column; gap: 4px; z-index: 1000; }
.user-dropdown-menu.show { display: flex; }
.user-dropdown-header { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.dropdown-role-badge { display: inline-block; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #818cf8; background: rgba(99, 102, 241, 0.15); padding: 2px 6px; border-radius: 4px; width: fit-content; }
.dropdown-email { font-size: 0.76rem; color: #94a3b8; word-break: break-all; }
.dropdown-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; font-size: 0.82rem; color: #cbd5e1; background: transparent; border: none; border-radius: 6px; text-decoration: none; cursor: pointer; text-align: left; transition: background 0.12s ease, color 0.12s ease; }
.dropdown-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.logout-item:hover { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* Диалог авторизации */
.login-dialog { max-width: 440px; width: 90vw; background: #0d121f; border: 1px solid rgba(99, 102, 241, 0.3); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7); color: #f8fafc; padding: 0; overflow: hidden; }
.login-heading-brand { display: flex; align-items: center; gap: 12px; }
.login-heading-brand img { filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.5)); }
.login-dialog-body { padding: 20px 24px 26px; }
.login-prompt-msg { background: rgba(99, 102, 241, 0.12); border-left: 3px solid #6366f1; padding: 10px 14px; border-radius: 6px; font-size: 0.82rem; color: #c7d2fe; margin-bottom: 16px; line-height: 1.4; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-submit-btn { margin-top: 6px; width: 100%; }
.login-error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; padding: 10px 14px; border-radius: 8px; font-size: 0.82rem; line-height: 1.4; }
.login-not-found-block { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.4); color: #fef3c7; padding: 12px 14px; border-radius: 8px; font-size: 0.82rem; line-height: 1.45; }
.login-not-found-block strong { color: #fde68a; }
.login-not-found-block .redirect-hint { color: #fcd34d; font-size: 0.76rem; margin: 6px 0 10px; }
.register-direct-btn { display: inline-block; background: #f59e0b; color: #0f172a; font-weight: 600; font-size: 0.8rem; padding: 6px 14px; border-radius: 6px; text-decoration: none; transition: background 0.15s ease; }
.register-direct-btn:hover { background: #fbbf24; }
.login-footer-links { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.78rem; }
.login-footer-links a { color: #818cf8; text-decoration: none; transition: color 0.15s ease; }
.login-footer-links a:hover { color: #a5b4fc; text-decoration: underline; }

/* Сохранённые сценарии расчётов */
.git-scenarios-section h3 { margin: 12px 0 8px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.git-scenarios-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.scenario-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(14, 29, 39, 0.6); }
.scenario-item-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.scenario-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scenario-title { font-size: 0.82rem; color: var(--text); }
.scenario-date { font-size: 0.7rem; color: var(--faint); font-family: var(--mono); }
.scenario-meta { font-size: 0.74rem; color: var(--muted); }
.scenario-author { color: var(--cyan); }
.scenario-comment { margin: 2px 0 0; color: #b0c4d4; font-size: 0.74rem; font-style: italic; }
.scenario-badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.scenario-badge.public { background: rgba(88, 212, 147, 0.15); color: var(--green); border: 1px solid rgba(88, 212, 147, 0.35); }
.scenario-badge.private { background: rgba(245, 196, 94, 0.15); color: var(--yellow); border: 1px solid rgba(245, 196, 94, 0.35); }
.scenario-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.scenario-load-btn { color: var(--cyan); }
.scenario-toggle-btn { color: var(--yellow); }

[data-theme="light"] dialog {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
}
[data-theme="light"] .login-dialog {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
}
[data-theme="light"] .login-nav-btn {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.35);
  color: #4338ca;
  font-weight: 600;
}
[data-theme="light"] .login-nav-btn:hover {
  background: rgba(79, 70, 229, 0.15);
  border-color: #4338ca;
  color: #312e81;
}
[data-theme="light"] .error-banner,
[data-theme="light"] .login-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
[data-theme="light"] .login-prompt-msg {
  background: #eef2ff;
  border-left-color: #4f46e5;
  color: #3730a3;
}
[data-theme="light"] .login-not-found-block {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}
[data-theme="light"] .login-not-found-block strong {
  color: #78350f;
}
[data-theme="light"] .login-not-found-block .redirect-hint {
  color: #b45309;
}
[data-theme="light"] .login-footer-links {
  border-top-color: var(--line);
}
[data-theme="light"] .login-footer-links a {
  color: #4f46e5;
  font-weight: 600;
}

/* Статус-бар Git и оформление фреймов в светлой теме */
[data-theme="light"] .git-status-bar {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-weight: 500;
}
[data-theme="light"] .git-status-bar strong {
  color: #064e3b;
  font-weight: 700;
}
[data-theme="light"] .git-status-bar .small-link-btn {
  color: #047857;
  font-weight: 600;
}
[data-theme="light"] .git-status-bar .small-link-btn:hover {
  color: #064e3b;
}

[data-theme="light"] .git-conn-guide {
  color: #334155;
}
[data-theme="light"] .git-conn-guide strong {
  color: #0f172a;
}
[data-theme="light"] .git-conn-guide a {
  color: #0284c7;
}
[data-theme="light"] .git-conn-guide code {
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-weight: 500;
}
[data-theme="light"] .git-conn-code-row code {
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
}
[data-theme="light"] .git-copy-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-weight: 500;
}
[data-theme="light"] .git-copy-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0284c7;
}

[data-theme="light"] .git-user-badge {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}
[data-theme="light"] .git-user-badge strong {
  color: #0369a1;
}
[data-theme="light"] .git-user-badge small {
  color: #64748b;
}
[data-theme="light"] .git-commit-form {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="light"] .git-file-list {
  color: #b45309;
}
[data-theme="light"] .git-clean {
  color: #15803d;
}
[data-theme="light"] .git-feedback.success {
  color: #15803d;
}

[data-theme="light"] .scenario-item {
  background: #ffffff;
  border-color: var(--line);
}
[data-theme="light"] .scenario-badge.public {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
[data-theme="light"] .scenario-badge.private {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}
[data-theme="light"] .scenario-author {
  color: #0284c7;
}
[data-theme="light"] .git-history-item {
  background: #ffffff;
  border-color: var(--line);
}
[data-theme="light"] .git-hist-msg {
  color: #334155;
}
[data-theme="light"] .scenario-comment {
  color: #475569;
}
[data-theme="light"] .user-dropdown-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .dropdown-item {
  color: #334155;
}
[data-theme="light"] .dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
[data-theme="light"] .dropdown-email {
  color: #64748b;
}
[data-theme="light"] .user-pill-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
[data-theme="light"] .user-pill-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
[data-theme="light"] .method-nav-bar {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
[data-theme="light"] .method-filter-pill:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
[data-theme="light"] .method-filter-pill.active {
  background: var(--cyan);
  color: #ffffff;
  border-color: var(--cyan);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}
[data-theme="light"] .method-lead {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0f172a;
}
[data-theme="light"] .method-card,
[data-theme="light"] .method-formula-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="light"] .method-list code {
  background: #e0f2fe;
  color: #0369a1;
}
[data-theme="light"] .method-formula-box code {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0369a1;
}
[data-theme="light"] .limitations {
  background: #fffbeb;
  border-left-color: #d97706;
}
