:root {
  --primary: #f7c600;
  --primary-hover: #ddb200;
  --secondary: #1e293b;
  --secondary-hover: #273449;
  --bg: #0b0f1c;
  --card-bg: #161e2e;
  --card-bg-2: #1b2436;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --border: #2d3748;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
  --container: 1180px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(100% - 24px, var(--container));
  margin: 24px auto 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(22, 30, 46, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(247, 198, 0, 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.brand-shell {
  width: min(100% - 24px, var(--container));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-preview {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  padding: 4px;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.brand-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(247, 198, 0, 0.12);
  color: var(--primary);
  font-size: 0.88rem;
  border: 1px solid rgba(247, 198, 0, 0.22);
}

.card {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card>header h2,
.card>h3,
.card>header h3 {
  margin-bottom: 6px;
}

.card>header p,
.info-msg {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.company-preview-card {
  margin-top: 20px;
}

.company-preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 12px;
}

.footer {
  padding: 20px 0 36px;
}

.footer>div {
  width: min(100% - 24px, var(--container));
  margin: 0 auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: #708198;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(247, 198, 0, 0.65);
  box-shadow: 0 0 0 3px rgba(247, 198, 0, 0.13);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 100px 140px auto;
  gap: 10px;
  margin: 14px 0 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.btn.primary {
  background: var(--primary);
  color: #111827;
}

.btn.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: var(--secondary-hover);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn.danger:hover {
  background: var(--danger);
  color: #fff;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text-muted);
  font-weight: 600;
  transition: var(--transition);
}

.tab-btn.active,
.tab-btn[aria-selected="true"] {
  background: var(--primary);
  color: #111827;
  border-color: transparent;
}

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

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 14px;
  border-radius: var(--radius-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.table th {
  text-align: left;
  padding: 14px 14px;
  background: rgba(247, 198, 0, 0.08);
  color: var(--primary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px;
  border-bottom: 1px solid rgba(45, 55, 72, 0.65);
  font-size: 0.94rem;
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.total-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(247, 198, 0, 0.08);
  border: 1px solid rgba(247, 198, 0, 0.18);
  color: var(--text);
  font-weight: 600;
}

.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(11, 15, 28, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.loader-overlay[hidden] {
  display: none !important;
}

.spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(247, 198, 0, 0.12);
  border-top-color: var(--primary);
  animation: mecprice-spin 0.8s linear infinite;
}

@keyframes mecprice-spin {
  to {
    transform: rotate(360deg);
  }
}

.info-msg {
  margin-top: 12px;
  min-height: 22px;
}

h2,
h3 {
  color: var(--text);
}

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

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

  .inline-form>*:first-child {
    grid-column: 1 / -1;
  }

  .inline-form .btn,
  .inline-form button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 16px, var(--container));
    margin-top: 16px;
  }

  .brand-shell {
    width: min(100% - 16px, var(--container));
    min-height: 68px;
  }

  .brand-text p {
    display: none;
  }

  .status-badge {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card {
    padding: 16px;
    border-radius: 10px;
  }

  .actions {
    flex-direction: column;
  }

  .actions .btn,
  .actions label.btn {
    width: 100%;
  }

  .tabs {
    gap: 8px;
  }

  .tab-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .table {
    min-width: 560px;
  }

  .company-preview {
    flex-direction: column;
    align-items: flex-start;
  }
}