:root {
  --bg: #e8edf7;
  --bg-2: #f5f8ff;
  --panel: #edf2fb;
  --panel-strong: #e4ebf7;
  --text: #21324a;
  --muted: #64789a;
  --primary: #6d87ff;
  --primary-dark: #4f6fe8;
  --success: #31b77c;
  --warning: #ffb84d;
  --danger: #ff7e7e;
  --shadow-dark: rgba(155, 169, 192, 0.58);
  --shadow-light: rgba(255, 255, 255, 0.9);
  --border: rgba(125, 142, 171, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(147, 171, 255, 0.2), transparent 30%),
    linear-gradient(135deg, var(--bg) 0%, #eff4fb 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100% - 30px));
  margin: 38px auto;
}

.neumorph-card {
  background: linear-gradient(145deg, rgba(239, 244, 251, 0.98), rgba(224, 232, 245, 0.96));
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 14px 14px 28px var(--shadow-dark), -12px -12px 24px rgba(255,255,255,0.9);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px;
  margin-bottom: 22px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  box-shadow: 10px 10px 22px rgba(89, 104, 194, 0.26);
}

.topbar h1 {
  margin: 5px 0 0;
  font-size: clamp(1.7rem, 2vw, 2.5rem);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(49, 183, 124, 0.12);
  color: var(--success);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(49, 183, 124, 0.9);
}

.soft-btn,
.accent-btn,
.primary-btn,
.close-btn {
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.soft-btn,
.accent-btn {
  padding: 11px 18px;
  border-radius: 14px;
  font-weight: 700;
}

.soft-btn {
  background: linear-gradient(145deg, #edf3ff, #dfeaf8);
  color: var(--text);
  box-shadow: 7px 7px 14px rgba(170, 181, 204, 0.25), -7px -7px 14px rgba(255,255,255,0.85);
}

.accent-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 10px 10px 18px rgba(93, 111, 211, 0.26);
}

.danger-btn {
  background: linear-gradient(145deg, #fff1f1, #f9dfe0);
  color: #a74848;
}

.primary-btn {
  grid-column: 1 / -1;
  appearance: none;
  border: none;
  border-radius: 18px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 10px 10px 20px rgba(76, 100, 182, 0.27), -8px -8px 18px rgba(255,255,255,0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  position: relative;
  overflow: hidden;
}

.primary-btn .submit-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border-radius: inherit;
}

.primary-btn .submit-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
  transition: width 0.2s ease;
}

.primary-btn .submit-progress-label {
  position: relative;
  z-index: 1;
  font-weight: 800;
}

.primary-btn.is-loading {
  padding-inline: 18px;
}

.primary-btn:disabled {
  opacity: 0.85;
  cursor: wait;
  transform: none;
}

.primary-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: white;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

.sync-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.sync-meta {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  gap: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.sync-meta strong {
  color: var(--text);
  font-size: 0.9rem;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(111, 130, 170, 0.12);
  overflow: hidden;
  box-shadow: inset 4px 4px 8px rgba(163, 177, 198, 0.2), inset -4px -4px 8px rgba(255,255,255,0.7);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #70d7ff);
  transition: width 0.5s ease;
  box-shadow: 0 0 14px rgba(109, 135, 255, 0.42);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.soft-btn:hover,
.accent-btn:hover,
.primary-btn:hover,
.close-btn:hover {
  transform: translateY(-2px);
}

.nav-tabs {
  display: inline-flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 22px;
}

.tab-button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-button.active {
  background: linear-gradient(145deg, #edf3ff, #dfeaf8);
  color: var(--primary-dark);
  box-shadow: inset 5px 5px 14px rgba(255,255,255,0.8), inset -6px -6px 12px rgba(157, 170, 198, 0.3);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.85fr;
  gap: 22px;
}

.panel {
  padding: 28px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  margin: 6px 0 0;
  font-size: 1.7rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.full-width {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: none;
  outline: none;
  background: rgba(228, 235, 247, 1);
  color: var(--text);
  padding: 16px 18px;
  border-radius: 18px;
  box-shadow: inset 6px 6px 14px rgba(163, 177, 198, 0.25), inset -6px -6px 12px rgba(255,255,255,0.9);
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: inset 6px 6px 14px rgba(163, 177, 198, 0.25), inset -6px -6px 12px rgba(255,255,255,0.9), 0 0 0 4px rgba(109, 135, 255, 0.12);
}

textarea {
  resize: vertical;
  min-height: 130px;
}

.summary-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-box {
  background: rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 18px 12px;
  text-align: center;
  box-shadow: inset 6px 6px 10px rgba(163,177,198,0.25), inset -6px -6px 10px rgba(255,255,255,0.72);
}

.stat-box strong {
  display: block;
  font-size: 1.7rem;
  margin-bottom: 6px;
}

.stat-box span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.mini-list {
  margin-top: 8px;
}

.mini-list h3 {
  margin-bottom: 12px;
  font-size: 1.08rem;
}

.mini-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.mini-list li {
  background: rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  box-shadow: inset 5px 5px 10px rgba(163,177,198,0.18), inset -5px -5px 10px rgba(255,255,255,0.7);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 30, 44, 0.26);
  backdrop-filter: blur(5px);
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(900px, calc(100% - 32px));
  max-height: 80vh;
  padding: 22px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.4rem;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, #edf3ff, #dfeaf8);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  box-shadow: 7px 7px 12px rgba(170, 181, 204, 0.25), -7px -7px 12px rgba(255,255,255,0.85);
}

.table-wrap {
  overflow: auto;
  max-height: 60vh;
  border-radius: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(100, 120, 154, 0.12);
}

th {
  background: rgba(255,255,255,0.22);
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.04);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(34, 45, 60, 0.94);
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: 0 18px 32px rgba(19, 26, 38, 0.22);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 18px, 1200px);
    margin: 22px auto 36px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .soft-btn,
  .accent-btn {
    flex: 1;
    text-align: center;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .tab-button {
    flex: 1;
  }
}
