:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #141824;
  --bg-card: #1a1f2e;
  --border: #2a3142;
  --border-focus: #4a5568;
  --accent: #6366f1;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --success: #10b981;
  --error: #ef4444;
  --shadow: rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 100%);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 32px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 12px;
  padding: 16px 16px 0;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-primary) 80%, transparent 100%);
  z-index: 10;
  padding-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  opacity: 0;
  transition: opacity 0.3s;
}

.tab span {
  position: relative;
  z-index: 1;
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-color: transparent;
  color: white;
  box-shadow: 0 8px 24px var(--accent-glow);
  transform: translateY(-2px);
}

.tab:not(.active):hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
header {
  padding: 24px 16px 32px;
  text-align: center;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

/* Form */
form {
  padding: 0 16px;
}

.form-section {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-field,
.input-field,
.textarea-field {
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s;
  appearance: none;
}

.select-field {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 48px;
  cursor: pointer;
}

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

.select-field:focus,
.input-field:focus,
.textarea-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.textarea-field {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.half {
  flex: 1;
  min-width: 0;
}

.select-field.half {
  padding-right: 40px;
}

.range-separator {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
}

/* Buttons */
.action-buttons {
  margin-top: 32px;
  padding: 0 0 16px;
}

.btn-primary {
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 20px;
}

/* Messages */
.msg {
  min-height: 24px;
  margin: 16px 0;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border);
}

.msg.err {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
}

.msg.ok {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
}

/* Responsive */
@media (max-width: 420px) {
  .tabs {
    gap: 8px;
    padding: 12px 12px 0;
  }

  .tab {
    padding: 12px 16px;
    font-size: 14px;
  }

  header h1 {
    font-size: 24px;
  }

  form {
    padding: 0 12px;
  }
}

/* Loading state */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.btn-primary.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Filters list */
.filter-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.filter-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.btn-edit {
  background: #4CAF50;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit:hover {
  background: #45a049;
  transform: scale(1.05);
}

.btn-delete {
  background: #ff4444;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: #cc0000;
  transform: scale(1.05);
}

.filter-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-details p {
  margin: 0;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 14px;
  color: #666;
}
