/* ═══════════════════════════════════════════
   Domain Panel — Stylesheet
   ═══════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2b6cff;
  --primary-dark: #1a55d8;
  --danger: #e33b3b;
  --danger-dark: #c62727;
  --success: #16a34a;
  --bg: #f2f5f9;
  --text: #1f2937;
  --border: #e5e9f0;
  --muted: #6b7280;
}

html, body {
  font-family: -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* LOGIN */
body.login-page {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1d2a44 0%, #2b6cff 100%);
  min-height: 100vh; padding: 20px;
}
.login-box {
  background: #fff; padding: 34px 28px 28px; border-radius: 14px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35); position: relative;
}
.login-langs {
  position: absolute; top: 14px; inset-inline-end: 16px;
  display: flex; gap: 8px; font-size: 12px;
}
.login-langs a {
  color: var(--muted); text-decoration: none;
  padding: 4px 8px; border-radius: 6px;
}
.login-langs a.active { background: var(--primary); color: #fff; }
.login-box h2 { margin-bottom: 22px; text-align: center; font-size: 20px; color: #1d2a44; }
.login-box label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: #4b5563; }
.login-box input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
}
.login-box input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,108,255,.15);
}
.login-box button {
  width: 100%; margin-top: 22px; background: var(--primary); color: #fff;
  border: 0; padding: 12px; border-radius: 8px; font-size: 15px;
  font-weight: 600; cursor: pointer; font-family: inherit;
}
.login-box button:hover { background: var(--primary-dark); }
.alert { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

/* TOPBAR */
.topbar {
  background: #1d2a44; color: #fff; padding: 12px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}
.topbar-left h1 { font-size: 17px; font-weight: 700; }
.topbar .lang-switch { display: flex; gap: 6px; margin-inline-start: auto; }
.topbar .lang-switch a {
  color: #cbd5e1; text-decoration: none;
  padding: 5px 10px; border-radius: 6px; font-size: 13px;
}
.topbar .lang-switch a.active { background: rgba(255,255,255,.15); color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-badge {
  background: rgba(255,255,255,.1); padding: 5px 12px;
  border-radius: 20px; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 4px;
}
.user-badge small { color: #cbd5e1; font-size: 11px; }
.count-badge {
  background: rgba(255,255,255,.1); padding: 5px 12px;
  border-radius: 20px; font-size: 12.5px;
}

/* BUTTONS */
.btn {
  background: var(--primary); color: #fff; border: 0; border-radius: 7px;
  padding: 8px 13px; cursor: pointer; text-decoration: none;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .15s; white-space: nowrap; font-family: inherit;
}
.btn:hover  { background: var(--primary-dark); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-dark); }
.btn.success { background: var(--success); }
.btn.success:hover { background: #15803d; }
.btn.ghost {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn.tiny { padding: 4px 9px; font-size: 11.5px; background: #e0e7ff; color: #3730a3; }
.btn.tiny:hover { background: #c7d2fe; }
.btn.tiny.danger { background: #fee2e2; color: #991b1b; }
.btn.tiny.danger:hover { background: #fecaca; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* CONTAINER */
.container { padding: 18px 22px; max-width: 100%; }
.container.narrow { max-width: 520px; margin: 0 auto; padding: 30px 22px; }

/* FILTERS */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff; font-family: inherit;
}
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,108,255,.12);
}
.filters input[type="text"] { min-width: 260px; flex: 1; max-width: 420px; }

/* TABLE */
.table-wrap { background: #fff; border-radius: 10px; overflow: auto; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
table.grid th, table.grid td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
table.grid thead { background: #eef3ff; }
table.grid th {
  font-weight: 600; color: #374151; font-size: 12px;
  text-transform: uppercase; letter-spacing: .3px;
}
table.grid tbody tr:hover { background: #f7faff; }
table.grid tbody tr:last-child td { border-bottom: 0; }
td.editable { min-width: 60px; }
td.editable[contenteditable="true"] { background: #fffbe6; outline: 2px solid #ffd569; outline-offset: -2px; }
td.editable.readonly { color: var(--muted); background: #fafbfc; }
td.actions { white-space: nowrap; display: flex; gap: 5px; }
td.notes-cell { max-width: 200px; white-space: normal; }
.note-view { font-size: 12px; color: #4b5563; margin-bottom: 4px; word-break: break-word; }
.muted { color: #9ca3af; }
.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }

/* COLUMNS PANEL */
.cols-panel {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 900; padding: 20px;
}
.cols-panel.hidden { display: none; }
.cols-box {
  background: #fff; padding: 24px; border-radius: 12px;
  max-width: 500px; width: 100%; max-height: 80vh; overflow: auto;
}
.cols-box h3 { margin-bottom: 16px; font-size: 16px; }
.chk-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; margin-bottom: 20px;
}
.chk {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #f8fafc; border-radius: 8px; font-size: 13px;
  cursor: pointer; border: 1px solid transparent;
}
.chk:hover { background: #eef3ff; border-color: #c7d2fe; }
.cols-actions, .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* MODALS */
.modal {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff; padding: 26px; border-radius: 12px;
  max-width: 720px; width: 100%; max-height: 88vh; overflow: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,.35); animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h3 { margin-bottom: 18px; font-size: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-grid label, .modal-box > label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: #4b5563;
}
.form-grid input, .form-grid select, .form-grid textarea,
.modal-box input, .modal-box textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; font-weight: 400;
}
.form-grid input:focus, .modal-box input:focus, .modal-box textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,108,255,.12);
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .hint { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.full-width { width: 100%; margin-bottom: 12px; font-family: inherit; }
textarea { resize: vertical; font-family: inherit; }

.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #eef; }
.modal-sub b { color: #1d2a44; font-family: Menlo, Consolas, monospace; }
.block-label {
  display: block; font-size: 12.5px; font-weight: 600; color: #4b5563;
  margin: 14px 0 6px;
}
.block-label input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; margin-top: 5px; font-weight: 400;
}

/* USER MANAGEMENT */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-head h2 { font-size: 18px; color: #1d2a44; }
.info-box {
  background: #eff6ff; padding: 12px 16px; border-radius: 10px;
  border-left: 3px solid var(--primary); margin-bottom: 16px;
  font-size: 13px; line-height: 1.7; color: #1e40af;
}
.you-badge {
  background: #dbeafe; color: #1e40af; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; margin-inline-start: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.role-select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; background: #fff; cursor: pointer;
  min-width: 90px; font-weight: 500; font-family: inherit;
}
.role-select:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }

/* CHANGE PASSWORD PAGE */
.card { background: #fff; padding: 28px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.05); }
.card h2 { font-size: 18px; margin-bottom: 6px; color: #1d2a44; }
.card .muted { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.password-form label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: #4b5563; margin: 16px 0 6px;
}
.password-form label small { color: var(--muted); font-weight: 400; }
.password-form input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; margin-top: 6px;
  font-family: inherit; font-weight: 400;
}
.password-form input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,108,255,.12);
}
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-actions .btn { flex: 1; justify-content: center; }
.form-actions .btn.ghost { color: #374151; border: 1px solid var(--border); background: #f3f4f6; }
.form-actions .btn.ghost:hover { background: #e5e7eb; }
.success-alert {
  background: #dcfce7; color: #166534; padding: 12px 14px;
  border-radius: 8px; border-left: 3px solid var(--success);
  margin-bottom: 16px; font-size: 13px;
}
.error-alert {
  background: #fee2e2; color: #991b1b; padding: 12px 14px;
  border-radius: 8px; border-left: 3px solid var(--danger);
  margin-bottom: 16px; font-size: 13px;
}

/* TOAST */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #1f2937; color: #fff; padding: 12px 22px;
  border-radius: 10px; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  opacity: 0; transition: all .3s ease;
  pointer-events: none; z-index: 2000; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: #b91c1c; }
#toast.success { background: #15803d; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 15px; }
  .container { padding: 12px; }
  .filters input[type="text"] { min-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .btn { padding: 7px 10px; font-size: 12px; }
}