:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --line: #dfe5ee;
  --line-soft: #edf1f6;
  --text: #0f172a;
  --muted: #667085;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0;
}

button, input, select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: #1f2937;
  border-radius: 5px;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
}

button:hover { border-color: #c8d2e2; background: #f8fafc; }

.hidden { display: none !important; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef3f9;
}

.login-card {
  width: 340px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.login-card h1 { margin: 8px 0 4px; font-size: 18px; }
.login-card p { margin: 0 0 18px; color: var(--muted); }
.login-mark { color: var(--green); font-weight: 700; }
.login-card label, .modal-card label {
  display: grid;
  gap: 6px;
  color: #344054;
  margin-bottom: 12px;
}

.login-card input, .modal-card input, .filter-search, .search-box input, select {
  border: 1px solid var(--line);
  border-radius: 5px;
  height: 30px;
  padding: 0 9px;
  background: #fff;
  color: var(--text);
}

.login-card button, .upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  padding: 0 14px;
}

.form-error {
  min-height: 16px;
  margin-top: 8px;
  color: var(--red);
}

.app { min-height: 100vh; }

.topbar {
  height: 58px;
  display: grid;
  grid-template-columns: 170px 260px 280px 210px 220px 82px 80px;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

.brand-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
}

.brand strong { display: block; font-size: 15px; }
.brand span, .period-control span, .currency-control span { display: block; color: var(--muted); font-size: 11px; }

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

.upload-button input { display: none; }
.ghost-button { background: #fff; }

.file-pill, .status-pill {
  height: 33px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 0 12px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.period-control {
  display: grid;
  grid-template-columns: 1fr 22px 1fr;
  gap: 4px;
  align-items: end;
}

.period-control span { grid-column: 1 / -1; }
.period-control select, .currency-control { height: 30px; }
.currency-control {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 10px;
  background: #fff;
}
.updated { font-weight: 700; }

.kpis {
  height: 66px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.kpis div {
  padding: 12px 26px;
  border-right: 1px solid var(--line);
}

.kpis span { display: block; color: #475467; margin-bottom: 4px; }
.kpis strong { font-size: 20px; }
.kpis .money { color: var(--green); }

.workspace {
  display: grid;
  grid-template-columns: 230px minmax(690px, 1fr) 335px;
  gap: 8px;
  padding: 8px;
}

.filters, .table-panel, .details, .import-panel, .warning-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.filters {
  height: 720px;
  overflow: auto;
  padding: 10px;
}

.panel-head, .details-head, .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-head button {
  border: 0;
  height: auto;
  padding: 0;
  color: #475467;
  background: transparent;
}

.filter-search { width: 100%; margin-bottom: 12px; }

.filter-group {
  margin-bottom: 14px;
}

.filter-title {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 7px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  color: #1f2937;
}

.check-row input {
  width: 13px;
  height: 13px;
  accent-color: #3b82f6;
}

.check-row small { color: #475467; }

.table-panel {
  height: 720px;
  display: grid;
  grid-template-rows: 52px 26px 1fr 47px;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
}

.search-box input { width: 205px; }
.toolbar-buttons { display: flex; gap: 7px; align-items: center; }
.toolbar-buttons select { width: 190px; }
.visible-count { padding: 0 18px; color: #475467; }
.table-wrap { overflow: auto; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }

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

th, td {
  height: 25px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fbfe;
  color: #344054;
  font-weight: 700;
}

td.num, th.num { text-align: right; }
tr.selected td { background: #edf5ff; outline: 1px solid #3b82f6; outline-offset: -1px; }
tr:hover td { background: #f7fbff; }

.group-row td {
  background: #f7f9fd;
  font-weight: 700;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.pagination select { width: 72px; height: 28px; }
.pagination button { width: 32px; padding: 0; }

.details {
  height: 720px;
  padding: 12px;
  overflow: auto;
}

.track-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.cover {
  width: 92px;
  height: 92px;
  border-radius: 4px;
  object-fit: cover;
  background: #0f172a;
}

.track-card h2 {
  margin: 0 0 5px;
  font-size: 14px;
}

.track-card p { margin: 2px 0; color: #475467; }
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  background: #e9f8ef;
  color: #15803d;
  font-weight: 700;
}

.mini-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.mini-section h3 {
  margin: 0 0 9px;
  font-size: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 85px 1fr 70px;
  gap: 8px;
  align-items: center;
  min-height: 20px;
}

.bar {
  height: 5px;
  border-radius: 8px;
  background: #e5e7eb;
  overflow: hidden;
}

.bar span { display: block; height: 100%; background: var(--green); }
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.meta-grid span { color: var(--muted); display: block; font-size: 10px; }
.empty-details { color: var(--muted); padding: 30px 0; text-align: center; }

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 10px;
  padding: 0 8px 8px;
}

.import-panel, .warning-panel {
  min-height: 190px;
  padding: 12px;
}

.import-panel strong, .warning-panel strong {
  display: block;
  margin-bottom: 10px;
}

.status {
  display: inline-block;
  border-radius: 5px;
  padding: 3px 7px;
  color: #166534;
  background: #dcfce7;
}

.status.error, .status.unrecognized { color: #991b1b; background: #fee2e2; }
.status.processing { color: #92400e; background: #fef3c7; }

.warning-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 7px 9px;
  margin-bottom: 7px;
}

.warning-icon {
  color: #fff;
  background: var(--orange);
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

dialog::backdrop { background: rgba(15, 23, 42, 0.28); }
.modal-card { width: 330px; padding: 16px; background: #fff; }
.modal-head button { width: 26px; padding: 0; border: 0; }
#savePassword { width: 100%; background: var(--blue); color: #fff; border: 0; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.2);
}

.import-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(246, 248, 251, 0.68);
  backdrop-filter: blur(2px);
}

.import-card {
  width: 360px;
  min-height: 150px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

.import-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.import-card p {
  margin: 0;
  color: #475467;
}

.import-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.import-progress {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 999px;
}

.import-progress span {
  display: block;
  width: 12%;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.import-card small {
  grid-column: 1 / -1;
  color: #667085;
}

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