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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f4f5;
  color: #111827;
  min-height: 100vh;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.title {
  font-size: 28px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-user {
  color: #4b5563;
  font-size: 14px;
}

.section {
  display: block;
}

.section[hidden],
#login-section[hidden],
#admin-content[hidden] {
  display: none !important;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.login-card {
  max-width: 420px;
  margin: 0 auto;
}

.login-card h2,
.card h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.hint {
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 20px;
}

.telegram-login {
  min-height: 44px;
}

.error-text {
  color: #dc2626;
  margin-top: 12px;
  line-height: 1.4;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table,
.users-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td,
.users-table th,
.users-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.users-table th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.main-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.nav-btn {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.nav-btn:hover:not(.active) {
  background: #f9fafb;
}

.content-section {
  display: block;
}

.content-section[hidden] {
  display: none !important;
}

.role-select {
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  font-size: 14px;
}

.role-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 600;
}

.secondary-btn {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.secondary-btn:hover {
  background: #f9fafb;
}

.primary-btn {
  border: none;
  background: #2563eb;
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.primary-btn:hover {
  background: #1d4ed8;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.order-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  background: #fafafa;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.order-card-title {
  font-size: 16px;
  font-weight: 700;
}

.order-card-meta {
  color: #6b7280;
  font-size: 13px;
  margin-top: 4px;
}

.order-view,
.order-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.order-field,
.order-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-field-full,
.order-form-field-full {
  grid-column: 1 / -1;
}

.order-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  font-size: 14px;
}

.field-textarea {
  resize: vertical;
  min-height: 96px;
}

.order-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.order-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .data-table th:nth-child(8),
  .data-table td:nth-child(8),
  .users-table th:nth-child(4),
  .users-table td:nth-child(4) {
    display: none;
  }

  .order-view,
  .order-form-grid {
    grid-template-columns: 1fr;
  }
}
