/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

a { color: #7ab4f5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 32px 36px;
  width: 100%;
  max-width: 380px;
}

.auth-title { font-size: 22px; font-weight: 700; color: #7ab4f5; margin-bottom: 4px; }
.auth-sub   { color: #888; margin-bottom: 24px; font-size: 12px; }
.auth-link  { margin-top: 16px; color: #888; font-size: 12px; text-align: center; }

.auth-stack { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; }

.info-panel {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 18px 28px;
  width: 100%;
  max-width: 380px;
}
.info-panel h2 { font-size: 14px; color: #7ab4f5; margin-bottom: 8px; }
.info-panel p { color: #aaa; font-size: 12px; line-height: 1.6; }

.contact-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 12px;
  color: #7ab4f5;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: border-color .15s, transform .15s;
  z-index: 10;
}
.contact-fab:hover { border-color: #4080d0; text-decoration: none; transform: translateY(-2px); }

/* ===== Alerts ===== */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 12px;
}
.alert-error   { background: #3d1515; border: 1px solid #7f2020; color: #f88; }
.alert-success { background: #143d14; border: 1px solid #207f20; color: #8f8; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label, .form-row label {
  display: block;
  margin-bottom: 4px;
  color: #aaa;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #1f2d50;
}
.form-row label { min-width: 200px; margin: 0; }
.form-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  width: 100%;
  background: #0f1b35;
  border: 1px solid #1f3060;
  border-radius: 4px;
  color: #e0e0e0;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: #4080d0; }

.form-row input[type=text],
.form-row input[type=password],
.form-row input[type=number],
.form-row select { width: auto; flex: 1; }

.form-row input[type=checkbox] { flex: 0 0 auto; }

.checkbox-group { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; color: #ccc; font-size: 13px; text-transform: none; letter-spacing: 0; }

.hint { color: #667; font-size: 11px; margin-bottom: 8px; }
.hint-inline { color: #667; font-size: 11px; margin-left: 6px; }
.form-hint { color: #666; }

fieldset.fieldset {
  border: 1px solid #1f3060;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
}
fieldset.fieldset legend { color: #7ab4f5; font-size: 11px; padding: 0 6px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary   { background: #2060c0; color: #fff; }
.btn-secondary { background: #3a3a4a; color: #ccc; border: 1px solid #555; }
.btn-success   { background: #1a6e2e; color: #fff; }
.btn-danger    { background: #7f1f1f; color: #fff; }
.btn-outline  { background: transparent; border: 1px solid #4080d0; color: #7ab4f5; }
.btn-block    { width: 100%; justify-content: center; margin-top: 8px; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }

/* ===== App layout ===== */
.app { display: flex; flex-direction: column; height: 100vh; }

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: #0f1b35;
  border-bottom: 1px solid #1f3060;
  flex-shrink: 0;
}
.header-logo    { font-size: 15px; font-weight: 700; color: #7ab4f5; }
.header-user    { font-weight: 600; color: #ccc; }
.header-expires { color: #666; font-size: 11px; }
.header .btn    { margin-left: auto; }

/* Control bar */
.control-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #111827;
  border-bottom: 1px solid #1f3060;
  flex-shrink: 0;
}

.status-indicator {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
}
.status-indicator.running { background: #22c55e; box-shadow: 0 0 6px #22c55e; }

.status-label { font-size: 12px; color: #aaa; min-width: 80px; }
.save-msg { font-size: 12px; color: #22c55e; }

/* Main layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Settings panel */
.settings-panel {
  width: 560px;
  min-width: 280px;
  max-width: 80vw;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1f3060;
  overflow: hidden;
}

.resizer {
  width: 5px;
  flex-shrink: 0;
  background: #1f3060;
  cursor: col-resize;
  transition: background 0.15s;
}
.resizer:hover, .resizer.dragging { background: #4080d0; }

@media (max-width: 700px) {
  /* На мобильном убираем height:100vh — страница скроллится естественно */
  .app { height: auto; min-height: 100vh; }
  .main-layout { flex-direction: column; overflow: visible; flex: none; }
  .settings-panel {
    width: 100% !important;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid #1f3060;
    overflow: visible;
    height: auto;
    flex-shrink: 1;
  }
  .tab-content {
    overflow-y: visible;
    height: auto;
    flex: none;
    max-height: none;
  }
  .resizer { display: none; }
  .log-panel { min-height: 220px; height: 280px; flex-shrink: 0; }
  .log-body { overflow-y: auto; }
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: #0f1b35;
  border-bottom: 1px solid #1f3060;
  flex-shrink: 0;
}

.tab {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid #1f3060;
  border-radius: 3px;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: #ccc; border-color: #4080d0; }
.tab.active { background: #2060c0; border-color: #2060c0; color: #fff; }

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.tab-content.active { display: block; }

/* Log panel */
.log-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #0f1b35;
  border-bottom: 1px solid #1f3060;
  font-size: 12px;
  color: #888;
  flex-shrink: 0;
}

.log-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  background: #0a0f1e;
}

.log-line { padding: 1px 0; }
.log-line.info    { color: #ccc; }
.log-line.warning { color: #facc15; }
.log-line.error   { color: #f87171; }
.log-line.success { color: #4ade80; }
.log-line.debug   { color: #666; }

/* ===== Admin ===== */
.admin-wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

.card {
  background: #16213e;
  border: 1px solid #1f3060;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 { font-size: 15px; margin-bottom: 14px; color: #7ab4f5; }

.inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form input { width: auto; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  border-bottom: 1px solid #1f3060;
}
.table td {
  padding: 10px;
  border-bottom: 1px solid #111827;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr.row-inactive td { opacity: 0.5; }
.table tr.row-expired td { opacity: 0.7; }

.actions { display: flex; gap: 6px; align-items: center; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #143d14; color: #4ade80; }
.badge-warning { background: #3d2c00; color: #facc15; }
.badge-error   { background: #3d1515; color: #f87171; }

code {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  background: #0f1b35;
  padding: 2px 6px;
  border-radius: 3px;
  color: #7ab4f5;
}

/* ===== Dashboard compact tables ===== */
.dtable-wrap { overflow-x: auto; margin: 6px 0; }
.dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
}
.dtable th {
  background: #0f1b35;
  color: #5a7a9a;
  padding: 4px 5px;
  font-size: 10px;
  text-transform: uppercase;
  border-bottom: 1px solid #1f3060;
  text-align: left;
}
.dtable td { padding: 2px 4px; border-bottom: 1px solid #111827; vertical-align: middle; }
.dtable tr:last-child td { border-bottom: none; }
.dtable input[type=text],
.dtable input[type=number],
.dtable select { padding: 2px 5px; font-size: 11px; height: 24px; }
.dtable input[type=checkbox] { width: 14px; height: 14px; cursor: pointer; }
.row-del {
  background: none; border: none; color: #f87171; cursor: pointer;
  font-size: 14px; padding: 1px 4px; line-height: 1;
}
.row-del:hover { color: #ff3333; }
.row-actions { white-space: nowrap; }
.row-actions button {
  background: none; border: none; cursor: pointer;
  color: #5a7a9a; font-size: 13px; padding: 1px 3px; line-height: 1;
}
.row-actions button:hover { color: #7ab4f5; }
.row-actions .row-del { color: #f87171; }
.row-actions .row-del:hover { color: #ff3333; }
.prio-num { color: #5a7a9a; font-size: 11px; text-align: center; width: 20px; }
.section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin: 10px 0 4px;
}
.section-ttl { font-size: 11px; text-transform: uppercase; color: #7ab4f5; letter-spacing: 0.5px; }

/* ===== Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0a0f1e; }
::-webkit-scrollbar-thumb { background: #2a4080; border-radius: 3px; }
