/* Domain Manager — базовые стили */
:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-h: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* Login */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #1e3a5f, #0f172a);
}
.login-wrap { width: 360px; }
.login-card {
  background: var(--card); border-radius: 12px; padding: 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.login-logo { font-size: 22px; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
h2 { font-size: 18px; margin-bottom: 20px; color: var(--text); }
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--muted); }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none;
}
.input:focus { border-color: var(--accent); }
.btn {
  display: inline-block; padding: 10px 16px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-block { width: 100%; }
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* App Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #0f172a; color: #fff;
  display: flex; flex-direction: column; padding: 20px 0; position: fixed; height: 100vh;
}
.sidebar__logo { padding: 0 20px 20px; font-size: 18px; font-weight: 700; border-bottom: 1px solid #1e293b; margin-bottom: 12px; }
.sidebar__nav a {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  color: #94a3b8; text-decoration: none; transition: .15s;
}
.sidebar__nav a:hover, .sidebar__nav a.active { background: #1e293b; color: #fff; }
.sidebar__user { margin-top: auto; padding: 16px 20px; border-top: 1px solid #1e293b; }
.user-login { font-weight: 600; display: block; }
.user-role { font-size: 12px; padding: 2px 8px; border-radius: 4px; display: inline-block; margin: 4px 0; }
.role-admin { background: var(--accent); color: #fff; }
.role-user { background: #334155; color: #cbd5e1; }
.btn-logout { color: #94a3b8; font-size: 12px; }

.main-content { margin-left: var(--sidebar-w); padding: 24px; flex: 1; }
h2 { font-size: 20px; margin-bottom: 16px; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #f9fafb; font-weight: 600; color: var(--muted); }
.table tr:hover { background: #f9fafb; }
.table tr.expired { background: #fef2f2; color: var(--danger); }

.badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-running { background: #dbeafe; color: #1e40af; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-manual { background: #ede9fe; color: #5b21b6; }

.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn { background: var(--accent); color: #fff; }
.btn:hover { opacity: .9; }

.form-group { margin-bottom: 16px; }
textarea.input { min-height: 120px; resize: vertical; }
select.input { appearance: auto; }
code { font-size: 12px; background: #f3f4f6; padding: 2px 4px; border-radius: 4px; }

/* Toolbar */
.toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.btn-secondary { background:#374151; color:#fff; }
.btn-secondary:hover { background:#4b5563; }
.hint { color:#6b7280; font-size:12px; }
.expired { background-color: rgba(239, 68, 68, 0.08); }
.row-manual { background: #faf5ff; }
.row-manual:hover { background: #f3e8ff; }
.selected-user { background: #dbeafe; border-color: #93c5fd; }

/* Action buttons in row */
.actions { display:flex; gap:6px; white-space:nowrap; }
.btn-success { background: var(--success); color:#fff; }
.btn-success:hover { background:#0e8a3a; }
.btn-danger  { background: var(--danger); color:#fff; }
.btn-danger:hover { background:#b91c1c; }
.loader { padding: 16px; color: var(--muted); }

/* Cards */
.card { background:var(--card); border:1px solid var(--border); border-radius:8px; padding:20px; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 12px; padding: 24px; width: 100%; max-width: 720px;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
.form-grid .input { padding: 8px 10px; font-size: 13px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Toasts */
.toasts {
  position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px;
  z-index: 2000; pointer-events: none;
}
.toast {
  padding: 10px 16px; border-radius: 8px; color: #fff; font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastIn .25s ease;
  max-width: 360px; pointer-events: auto;
}
.toast-info { background: var(--accent); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: none; } }

/* Mobile sidebar */
.burger {
  display: none; background: none; border: none; font-size: 22px; cursor: pointer;
  padding: 4px 10px; margin-bottom: 12px;
}
.sidebar__toggle { display:none; background:none; border:none; color:#fff; font-size:24px; cursor:pointer; margin-left:auto; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; z-index: 1500; }
  .sidebar.open { transform: translateX(0); }
  .sidebar__toggle, .burger { display: inline-block; }
  .main-content { margin-left: 0; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .table { font-size: 12px; }
}

