/* Coffee Panel — панель разработчика */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #0f1419;
  color: #e6e9ef;
  line-height: 1.5;
}

.muted { color: #8b95a5; font-size: 13px; }
.error { color: #ff6b6b; font-size: 13px; margin-top: 12px; min-height: 18px; }
.warn-big { background: #fff3e0; color: #b45200; padding: 12px 16px; border-radius: 8px; font-size: 13px; }

/* ============ LOGIN ============ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2029 0%, #0f1419 100%);
}
.login-box {
  background: #1a2029;
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border: 1px solid #2a3240;
}
.login-box .logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.login-box h1 { margin: 0 0 4px; text-align: center; font-size: 22px; }
.login-box .muted { text-align: center; margin-bottom: 28px; }
.login-box label { display: block; margin: 16px 0 6px; font-size: 13px; color: #8b95a5; }
.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: #0f1419;
  border: 1px solid #2a3240;
  border-radius: 8px;
  color: #e6e9ef;
  font-size: 14px;
}
.login-box input:focus { outline: none; border-color: #4a9eff; }

/* ============ DASHBOARD ============ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #1a2029;
  border-bottom: 1px solid #2a3240;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.logo-sm { font-size: 20px; }
.version-badge {
  background: #2a3240;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #8b95a5;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}
.stat-card {
  background: #1a2029;
  padding: 16px 18px;
  border-radius: 10px;
  border-left: 4px solid #4a9eff;
}
.stat-card.ok { border-left-color: #2ecc71; }
.stat-card.warn { border-left-color: #f39c12; }
.stat-card.bad { border-left-color: #e74c3c; }
.stat-card.rev { border-left-color: #9b59b6; }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-lbl { font-size: 12px; color: #8b95a5; margin-top: 4px; }

.controls {
  display: flex;
  gap: 10px;
  padding: 0 24px 16px;
  flex-wrap: wrap;
}
.controls input, .controls select {
  padding: 9px 12px;
  background: #1a2029;
  border: 1px solid #2a3240;
  border-radius: 8px;
  color: #e6e9ef;
  font-size: 14px;
}
.controls input[type="search"] { flex: 1; min-width: 220px; }

.btn {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.btn.primary { background: #4a9eff; color: #fff; }
.btn.primary:hover { background: #3a8eef; }
.btn.ghost { background: transparent; color: #8b95a5; border: 1px solid #2a3240; }
.btn.ghost:hover { color: #e6e9ef; border-color: #4a9eff; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.danger { background: #e74c3c; color: #fff; }

/* ============ CLIENTS ============ */
.clients-list {
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.client-card {
  background: #1a2029;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #2a3240;
  cursor: pointer;
  transition: 0.15s;
  position: relative;
}
.client-card:hover { border-color: #4a9eff; transform: translateY(-1px); }

.client-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 12px;
}
.client-name { font-weight: 700; font-size: 16px; }
.client-domain { font-size: 12px; color: #8b95a5; margin-top: 2px; }

.health-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.health-dot.ok { background: #2ecc71; box-shadow: 0 0 8px #2ecc71; }
.health-dot.warn { background: #f39c12; box-shadow: 0 0 8px #f39c12; }
.health-dot.offline { background: #e74c3c; box-shadow: 0 0 8px #e74c3c; }
.health-dot.new { background: #6b7280; }

.client-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12px;
  color: #8b95a5;
  margin-bottom: 12px;
}
.client-meta b { color: #e6e9ef; font-weight: 600; }

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
}
.badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: #2a3240;
  color: #b8c1cf;
}
.badge.rent { background: #1e3a5f; color: #6bb6ff; }
.badge.buy { background: #3a2f5f; color: #b48fff; }
.badge.free { background: #1e4f32; color: #6effa8; }
.badge.warning { background: #5f3a1e; color: #ffb86b; }
.badge.overdue, .badge.blocked { background: #5f1e1e; color: #ff8888; }

/* ============ MODAL ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-box {
  background: #1a2029;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #2a3240;
  position: relative;
}
.modal-box.wide { max-width: 640px; }
.modal-box h2 { margin: 0 0 20px; font-size: 20px; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  background: none; border: none;
  font-size: 28px; color: #8b95a5;
  cursor: pointer; padding: 4px 10px;
  line-height: 1;
}
.modal-close:hover { color: #e6e9ef; }

.modal-box label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13px;
  color: #8b95a5;
}
.modal-box input, .modal-box select, .modal-box textarea {
  width: 100%;
  padding: 9px 12px;
  background: #0f1419;
  border: 1px solid #2a3240;
  border-radius: 8px;
  color: #e6e9ef;
  font-size: 14px;
  font-family: inherit;
}
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus {
  outline: none; border-color: #4a9eff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.copy-row { margin: 14px 0; }
.copy-field { display: flex; gap: 6px; }
.copy-field input {
  font-family: monospace;
  font-size: 12px;
  background: #0f1419;
}

/* ============ CLIENT DETAIL ============ */
.detail-section { margin-bottom: 20px; }
.detail-section h3 {
  font-size: 13px;
  color: #8b95a5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 8px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  font-size: 13px;
}
.detail-grid .k { color: #8b95a5; }
.detail-grid .v { color: #e6e9ef; font-weight: 600; }
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #2a3240;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #8b95a5;
}
.empty-state .logo { font-size: 60px; opacity: 0.3; }
