/* ============================================================
   Rindy dealer cabinet — styles
   Plain CSS, no framework, no external fonts (CDN blocked in RU).
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f4f5f7;
  --card:      #ffffff;
  --ink:       #1d2330;
  --muted:     #7b8494;
  --accent:    #2563eb;
  --accent-d:  #1d4ed8;
  --border:    #e2e5ea;
  --ok:        #16a34a;
  --bad:       #dc2626;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---- Login ---- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  width: 100%;
  max-width: 360px;
  padding: 36px 32px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand-big {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 3px;
  text-align: center;
  color: var(--accent);
}
.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

/* ---- Form fields ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--muted); }
input, select {
  font-size: 15px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s;
  background: #fff;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
input[readonly] { background: var(--bg); color: var(--muted); }

button {
  font-size: 15px;
  font-weight: 600;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}
button:hover { background: var(--accent-d); }
button:disabled { opacity: .6; cursor: default; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 7px 14px;
  font-size: 14px;
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

.error {
  color: var(--bad);
  font-size: 14px;
  min-height: 18px;
  text-align: center;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
}
.user-info { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; font-size: 14px; }
.role-badge {
  font-size: 12px;
  background: var(--bg);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ---- Content ---- */
.content { max-width: 980px; margin: 0 auto; padding: 28px 24px; }
.content h2 { font-size: 18px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---- Device cards ---- */
.devices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.device-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow .15s, transform .05s;
}
.device-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.13); }
.device-card:active { transform: scale(.99); }

/* ---- Device page ---- */
.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  margin-bottom: 14px;
}
.back-link:hover { text-decoration: underline; }
.device-page-head { display: flex; align-items: center; gap: 10px; }
.device-page-head h2 { margin: 0; }
.device-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.device-page-actions { margin-top: 14px; }
.section-title { font-size: 16px; margin: 26px 0 12px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 12px;
}
.section-head .section-title { margin: 0; }
.device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.device-name { font-weight: 600; font-size: 15px; }
.device-meta { font-size: 12px; color: var(--muted); }
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--ok); }
.status-dot.offline { background: #c2c8d0; }

/* ---- Login: forms & steps ---- */
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hidden { display: none !important; }
.hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 2px;
}
.hint b { color: var(--ink); }

/* ---- Topbar navigation ---- */
.topbar-left { display: flex; align-items: center; gap: 28px; }
.nav { display: flex; gap: 6px; }
.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
}
.nav-link:hover { background: var(--bg); color: var(--ink); }
.nav-link.active { background: var(--bg); color: var(--accent); }

/* ---- Page head ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-head h2 { margin: 0; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }
.search-input { width: 240px; padding: 8px 12px; font-size: 14px; }

/* ---- Device card actions ---- */
.device-actions { margin-top: 10px; }

/* ---- Data table ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 11px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; }

/* ---- Badges ---- */
.badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-ok  { background: #dcfce7; color: #15803d; }
.badge-bad { background: #fee2e2; color: #b91c1c; }
.badge-gsm { background: #dbeafe; color: #1d4ed8; }
.badge-ble { background: #e0e7ff; color: #4338ca; }
.badge-rf  { background: #fef3c7; color: #b45309; }
.badge-app  { background: #ccfbf1; color: #0f766e; }

/* "Open device" primary button on the device page */
.btn-mini.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
}
.btn-mini.btn-primary:hover { background: var(--accent-d); }
.badge-wifi { background: #fce7f3; color: #be185d; }

/* ---- Device capabilities row in header ---- */
.device-caps {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.caps-label { font-size: 13px; color: var(--muted); }

/* ---- Capabilities (fieldset of channel checkboxes) ---- */
.caps-set {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px 10px;
  margin: 0;
}
.caps-set legend {
  font-size: 13px;
  color: var(--muted);
  padding: 0 6px;
}
.cap-check {
  display: block;
  padding: 5px 0;
  font-size: 14px;
  cursor: pointer;
}
.cap-check input {
  margin-right: 8px;
  vertical-align: middle;
  width: auto;
}
.caps-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ---- Mini buttons ---- */
.btn-mini {
  font-size: 13px;
  padding: 6px 11px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-mini:hover { background: #e9ebef; }
.btn-danger { color: var(--bad); border-color: #f3c6c6; }
.btn-danger:hover { background: #fee2e2; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,25,35,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--card);
  width: 100%;
  max-width: 380px;
  padding: 24px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-card h3 { font-size: 17px; margin-bottom: 4px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.modal-actions button { width: auto; }

/* ---- Tabs (dashboard: 'В работе' / 'Склад') ---- */
.tabs {
  display: flex;
  gap: 0;
  margin: 4px 0 16px 0;
  border-bottom: 1px solid #e0e3eb;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 0;
  width: auto;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Sub-tabs (in device page Abonenty) ---- */
.tabs-sub {
  margin: 0 0 14px 0;
  border-bottom: 1px solid #eef0f4;
}
.tabs-sub .tab {
  font-size: 13px;
  padding: 8px 14px;
}
.tab-pane { margin-top: 16px; }

/* ---- Sub-toolbar (search + action button) ---- */
.sub-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 6px 0 10px 0;
}
.sub-toolbar .search-input { flex: 1; }
.sub-toolbar button { width: auto; flex-shrink: 0; }

/* ---- Section title alongside ---- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 10px 0;
}

/* ---- Frozen subscriber row ---- */
.row-frozen td { opacity: 0.55; }
.badge-frozen {
  background: #e0eaff;
  color: #3a4ea0;
  border: 1px solid #c5d4ff;
  font-weight: 500;
}

/* ---- Под app-юзером: список зарегистрированных телефонов ---- */
.row-detail td {
  background: #f7f9fc;
  padding: 10px 14px 14px 14px;
  border-bottom: 1px solid #e6e9ee;
}
.phones-list { display: flex; flex-direction: column; gap: 6px; }
.phone-chip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: 6px;
  font-size: 13px;
}
.phone-chip-frozen { opacity: 0.65; background: #f4f6fa; }
.phone-actions { margin-left: auto; display: flex; gap: 6px; }
.phones-hint {
  margin-top: 6px; padding: 8px 10px;
  background: #fff8e1; border: 1px solid #f5e3a8; border-radius: 6px;
  color: #5a4a10; font-size: 12px;
}

/* ---- Inline pencil-rename next to device title ---- */
.device-page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#renameBtnInline {
  font-size: 14px;
  padding: 2px 8px;
  line-height: 1.2;
  width: auto;
}
