:root {
  color-scheme: light;
  --bg: #f4efe6;
  --panel: rgba(255, 252, 247, 0.84);
  --panel-strong: #fffaf2;
  --text: #1f2937;
  --muted: #6b7280;
  --line: rgba(31, 41, 55, 0.12);
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #c2410c;
  --danger: #b91c1c;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(194, 65, 12, 0.18), transparent 24%),
    linear-gradient(180deg, #f8f4ec 0%, #efe6d7 100%);
}

body.modal-open {
  overflow: hidden;
}

.app-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  padding: 24px;
  transition: width 180ms ease, padding 180ms ease;
}

.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.95), rgba(255, 247, 237, 0.9)),
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 65%);
  box-shadow: var(--shadow);
  border-radius: 0 28px 28px 0;
  justify-content: flex-start;
  overflow: hidden;
  transition: padding 180ms ease, border-radius 180ms ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 16px;
  margin-bottom: 8px;
  color: var(--brand-strong);
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: var(--brand-strong);
  background: rgba(15, 118, 110, 0.12);
  transition: transform 120ms ease, background 120ms ease;
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
  background: rgba(15, 118, 110, 0.18);
}

.sidebar-toggle svg {
  transition: transform 180ms ease;
}

.sidebar-menu-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-group-title {
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.locale-toggle {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 14px;
  min-width: 60px;
  font-weight: 700;
  color: var(--brand-strong);
  background: rgba(15, 118, 110, 0.12);
  transition: transform 120ms ease, background 120ms ease;
}

.locale-toggle:hover {
  transform: translateY(-1px);
  background: rgba(15, 118, 110, 0.18);
}

.panel {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 24px;
  min-width: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main-content {
  margin-left: 320px;
  min-height: 100vh;
  padding: 32px;
  display: grid;
  gap: 20px;
  align-content: start;
  min-width: 0;
  transition: margin-left 180ms ease, padding 180ms ease;
}

.main-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 120ms ease, color 120ms ease;
}

.tab:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.4);
  color: var(--text);
}

.tab:hover .tab-icon {
  opacity: 1;
}

.tab.is-active {
  background: var(--panel-strong);
  color: var(--brand-strong);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.tab.is-active .tab-icon {
  opacity: 1;
}

.tab-text {
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 36px;
  margin-top: 2px;
}

.sub-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.sub-tab:hover {
  background: rgba(255, 255, 255, 0.3);
  color: var(--text);
}

.sub-tab.is-active {
  color: var(--brand-strong);
  font-weight: 600;
}

.search-form {
  display: grid;
  gap: 18px;
}

.search-form.is-hidden {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field.wide {
  max-width: 840px;
}

label {
  font-weight: 600;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.file-input-hidden,
.file-input-proxy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: rgba(15, 118, 110, 0.45);
}

.actions {
  display: flex;
  gap: 12px;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.upload-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selected-file {
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.upload-dropzone {
  min-height: 280px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(31, 41, 55, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-visible {
  border-color: rgba(15, 118, 110, 0.4);
  background: rgba(15, 118, 110, 0.04);
  outline: none;
}

.upload-dropzone.is-dragover {
  border-color: rgba(15, 118, 110, 0.6);
  background: rgba(15, 118, 110, 0.08);
  transform: translateY(-1px);
}

.upload-dropzone-copy {
  max-width: 560px;
}

.upload-dropzone-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  color: rgba(31, 41, 55, 0.46);
  font-weight: 700;
  line-height: 1.35;
}

.upload-dropzone-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

button {
  font: inherit;
}

.primary,
.ghost,
.action-button {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 700;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.primary:hover,
.ghost:hover,
.action-button:hover {
  transform: translateY(-1px);
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

.ghost {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

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

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

.result-toolbar h2 {
  margin: 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
}

.status-chip {
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-strong);
  font-weight: 700;
  white-space: nowrap;
}

.error-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
  border: 1px solid rgba(185, 28, 28, 0.18);
}

.progress-card {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  background: rgba(15, 118, 110, 0.06);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 10px;
}

.progress-title {
  font-weight: 700;
}

.progress-meta {
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand), #0d9488);
  transition: width 180ms ease;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(100%, 420px);
  padding: 24px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.modal-title {
  margin: 0;
  font-size: 20px;
}

.modal-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.modal-action-button,
.modal-secondary-button {
  width: 100%;
}

.modal-secondary-button {
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
  transition: transform 120ms ease, background 120ms ease;
}

.modal-secondary-button:hover {
  transform: translateY(-1px);
}

.is-hidden {
  display: none;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.pagination-per-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.pagination-select {
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.pagination-jump-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-jump-input {
  width: 88px;
  padding: 10px 12px;
  text-align: center;
}

.pagination-button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.pagination-indicator {
  min-width: 110px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1220px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: rgba(15, 23, 42, 0.04);
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pill.yes {
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-strong);
}

.pill.no {
  background: rgba(107, 114, 128, 0.14);
  color: #4b5563;
}

.action-button {
  min-width: 110px;
  color: white;
  background: linear-gradient(135deg, #c2410c, #ea580c);
}

.action-button.is-loading {
  opacity: 0.75;
  cursor: progress;
}

.action-button.is-empty {
  background: rgba(107, 114, 128, 0.22);
  color: #374151;
}

.action-button.is-pending {
  background: rgba(15, 118, 110, 0.18);
  color: var(--brand-strong);
}

.action-button.is-success {
  background: linear-gradient(135deg, #0f766e, #0d9488);
}

.action-group {
  display: grid;
  gap: 8px;
}

.phone-action {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.link {
  color: var(--brand-strong);
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

@media (min-width: 721px) {
  body.sidebar-collapsed .sidebar {
    width: 104px;
    padding: 24px 12px;
  }

  body.sidebar-collapsed .sidebar-inner {
    padding: 24px 10px;
    align-items: center;
  }

  body.sidebar-collapsed .sidebar-header {
    width: 100%;
    justify-content: center;
    flex-direction: column;
  }

  body.sidebar-collapsed .sidebar-logo {
    margin-bottom: 0;
    padding: 8px 0;
    justify-content: center;
  }

  body.sidebar-collapsed .logo-text,
  body.sidebar-collapsed .sidebar-group-title,
  body.sidebar-collapsed .tab-text {
    display: none;
  }

  body.sidebar-collapsed .sidebar-menu-group,
  body.sidebar-collapsed .sidebar-nav {
    width: 100%;
    align-items: center;
  }

  body.sidebar-collapsed .tab {
    width: 52px;
    padding: 12px;
    justify-content: center;
  }

  body.sidebar-collapsed .main-content {
    margin-left: 104px;
  }

  body.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
  }
}

@media (max-width: 1080px) {
  .sidebar {
    width: 280px;
    padding: 16px;
  }

  .sidebar-inner {
    padding: 20px 14px;
  }

  .main-content {
    margin-left: 280px;
    padding: 24px 20px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.sidebar-collapsed .sidebar {
    width: 96px;
    padding: 16px 10px;
  }

  body.sidebar-collapsed .sidebar-inner {
    padding: 20px 8px;
  }

  body.sidebar-collapsed .main-content {
    margin-left: 96px;
  }
}

@media (max-width: 720px) {
  .sidebar-toggle {
    display: none;
  }

  .sidebar {
    position: static;
    width: auto;
    padding: 16px 16px 0;
  }

  .sidebar-inner {
    height: auto;
    border-right: 0;
    border-radius: 24px;
    justify-content: flex-start;
  }

  .main-content {
    margin-left: 0;
    min-height: auto;
    padding: 16px;
  }

  .panel {
    padding: 18px;
  }

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

  .result-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions,
  .progress-copy {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    flex-wrap: wrap;
  }

  .upload-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .selected-file {
    text-align: left;
  }

  .pagination {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .pagination-jump-form {
    width: 100%;
  }

  .pagination-per-page {
    width: 100%;
  }

  .modal {
    padding: 16px;
  }

  .modal-card {
    padding: 20px;
  }
}
