:root {
  --slate-950: #0A0B0D;
  --slate-900: #14161A;
  --slate-850: #1C1F26;
  --slate-800: #2D3139;
  --slate-600: #5A5E66;
  --slate-500: #8E9299;
  --slate-400: #8E9299;
  --slate-300: #B0B3B8;
  --slate-200: #E0E0E0;
  --rose-600: #E11D48;
  --rose-550: #F43F5E;
  --rose-750: #9B0F2F;
  --emerald-650: #10B981;
  --cyan-650: #0891B2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--slate-950);
  color: var(--slate-200);
  font-family: ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Login card */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  width: 100%;
  max-width: 28rem;
  background: var(--slate-900);
  border: 1px solid var(--slate-800);
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.card-wide {
  max-width: 64rem;
}

.card-header {
  background: var(--rose-600);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #fff;
}

.card-header.cyan {
  background: var(--cyan-650);
}

.card-header-icon {
  padding: 0;
  background: transparent;
  border-radius: 0;
  display: flex;
  flex-shrink: 0;
}

.card-header-icon svg {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.card-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.card-header p {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.card-body {
  padding: 2rem;
}

.card-footer {
  background: var(--slate-950);
  padding: 1rem 2rem;
  border-top: 1px dashed var(--slate-900);
  display: flex;
  justify-content: space-between;
  font-size: 0.625rem;
  color: var(--slate-600);
  font-family: ui-monospace, monospace;
}

.card-footer-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.card-footer a,
.about-body a {
  color: var(--slate-300);
}

.auth-trust {
  padding: 1rem 2rem 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--slate-400);
}

.auth-trust p {
  margin: 0 0 0.5rem;
}

.auth-domain strong {
  color: var(--slate-200);
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-lead,
.about-note {
  margin: 0;
  line-height: 1.55;
  color: var(--slate-300);
}

.about-facts {
  margin: 0;
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.65rem 1rem;
  font-size: 0.875rem;
}

.about-facts dt {
  color: var(--slate-500);
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  font-size: 0.6875rem;
}

.about-facts dd {
  margin: 0;
  color: var(--slate-200);
}

.about-login-btn {
  align-self: flex-start;
  text-decoration: none;
  display: inline-flex;
}

label {
  display: block;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-400);
  margin-bottom: 0.5rem;
}

input,
select {
  width: 100%;
  background: var(--slate-950);
  color: var(--slate-200);
  border: 1px solid var(--slate-800);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  border-color: var(--rose-600);
}

input.mono {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.1em;
}

.field {
  margin-bottom: 1.25rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 0.75rem;
  padding: 0.875rem 1.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  background: var(--rose-600);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--rose-550);
}

.btn-secondary {
  background: var(--slate-850);
  color: var(--slate-300);
  border: 1px solid var(--slate-800);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--slate-800);
}

.btn-danger {
  background: var(--rose-750);
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

.btn-danger:hover:not(:disabled) {
  background: var(--rose-600);
}

.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
}

.alert {
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.alert-error {
  background: rgba(155, 15, 47, 0.3);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fda4af;
}

.alert-info {
  background: rgba(8, 145, 178, 0.15);
  border: 1px solid rgba(8, 145, 178, 0.3);
  color: #67e8f9;
}

.login-message {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.45;
  background: rgba(155, 15, 47, 0.3);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fda4af;
}

/* App header (как у бригады) */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.app-header {
  background: var(--slate-900);
  border-bottom: 1px solid var(--slate-800);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header-brand svg {
  color: var(--rose-600);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.app-header-title {
  font-size: 0.875rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--slate-200);
}

.app-header-divider {
  width: 1px;
  height: 1rem;
  background: var(--slate-800);
  display: none;
}

.app-header-info {
  text-align: left;
}

.app-header-sub {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header-sub-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  font-family: ui-monospace, monospace;
  color: var(--slate-500);
}

.app-header-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.5625rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  border: 1px solid rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-650);
}

.app-header-user {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-300);
  margin-top: 0.125rem;
}

.app-header-user strong {
  color: #fff;
}

.app-header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
}

.app-header-clock {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--slate-300);
  font-family: ui-monospace, monospace;
  background: var(--slate-950);
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--slate-850);
}

.app-header-clock svg {
  color: var(--rose-550);
  flex-shrink: 0;
}

.app-header-clock-time {
  font-weight: 700;
}

.app-header-clock-sep {
  color: var(--slate-600);
}

.app-header-clock-date {
  font-size: 0.625rem;
  text-transform: capitalize;
}

.app-header-sep {
  width: 1px;
  height: 1rem;
  background: var(--slate-800);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--slate-950);
  color: var(--slate-400);
  border: 1px solid var(--slate-850);
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-weight: 700;
  font-size: 0.6875rem;
  font-family: ui-monospace, monospace;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
  background: rgba(155, 15, 47, 0.2);
  color: var(--rose-550);
  border-color: rgba(155, 15, 47, 0.4);
}

.app-main {
  flex: 1;
  padding: 1.5rem;
  overflow: auto;
}

@media (min-width: 768px) {
  .app-header-divider {
    display: block;
  }
}

/* Admin panel */
.panel-page {
  min-height: 100vh;
}

.panel-shell {
  max-width: 72rem;
  margin: 0 auto;
}

.panel-heading {
  margin-bottom: 1.5rem;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.panel-heading .meta {
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  color: var(--slate-500);
  margin-top: 0.25rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 22rem;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

.section-title {
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  margin: 0 0 1rem;
}

.users-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.65rem;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  border-bottom: 1px solid var(--slate-850);
}

td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--slate-850);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(28, 31, 38, 0.5);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-family: ui-monospace, monospace;
  font-weight: 600;
}

.badge-crew {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-650);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-admin {
  background: rgba(225, 29, 72, 0.15);
  color: var(--rose-550);
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--slate-500);
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.form-actions .btn-primary {
  width: auto;
  flex: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal {
  width: 100%;
  max-width: 28rem;
}

.modal .card-header,
#edit-modal .card-header {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  padding: 0.45rem 0.85rem;
  gap: 0.5rem;
}

.modal .card-header h1 {
  font-size: 0.875rem;
  line-height: 1.25;
}

.modal .card-header p {
  margin: 0.1rem 0 0;
  font-size: 0.7rem;
  line-height: 1.2;
}
