:root {
  --ink-950: #0f1720;
  --ink-900: #18222c;
  --ink-700: #314353;
  --ink-500: #5b7084;
  --sand-50: #f7f4ef;
  --sand-100: #f0ebe2;
  --sand-200: #e7decd;
  --line: #c8bcaa;
  --accent: #9f6b2f;
  --accent-strong: #7d4f1f;
  --success: #0f766e;
  --danger: #b42318;
  --card-glass: rgba(247, 244, 239, 0.9);
  --card-glass-strong: rgba(250, 247, 241, 0.95);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  color: var(--ink-900);
  font-family: "Fira Sans", "Noto Sans", "Ubuntu", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(8, 12, 16, 0.78), rgba(22, 28, 34, 0.64)),
    url('/static/media/photo_2024-10-30_17-34-21.jpg') center center / cover no-repeat;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  z-index: -1;
}

h1,
h2,
h3,
strong,
th {
  font-family: "Fira Sans", "Noto Sans", "Ubuntu", sans-serif;
  letter-spacing: 0.01em;
}

header,
.controls,
.status,
.tabs,
.panel {
  position: relative;
  z-index: 1;
  width: min(1300px, 100%);
  margin-left: auto;
  margin-right: auto;
}

header {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  backdrop-filter: blur(8px);
}

header h1 {
  margin: 0;
  color: var(--ink-950);
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 700;
}

header p {
  margin: 10px 0 0;
  color: var(--ink-700);
}

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

.controls {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  backdrop-filter: blur(8px);
}

.controls label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-900);
  font-weight: 500;
}

input[type="date"],
input[type="email"],
input[type="password"] {
  border: 1px solid #b9ab96;
  background: #fffdf9;
  color: var(--ink-900);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(159, 107, 47, 0.18);
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.06);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-secondary {
  width: 100%;
  color: var(--ink-900);
  border-color: #b8ab98;
  background: linear-gradient(135deg, #f6eee0, #eadac1);
}

.button-secondary:hover {
  filter: brightness(1.02);
}

.status {
  margin-top: 10px;
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink-900);
}

.tabs {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  background: rgba(240, 235, 226, 0.9);
  color: var(--ink-900);
  border: 1px solid #b8ab98;
}

.tab.active {
  background: linear-gradient(135deg, #1b242d, #0f1821);
  color: #f8f2e9;
  border-color: #1b242d;
}

.panel {
  display: none;
  margin-top: 12px;
  background: var(--card-glass-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(8px);
}

.panel.active {
  display: block;
}

.panel h2 {
  margin-top: 0;
  color: var(--ink-950);
}

.panel h3 {
  margin-bottom: 8px;
  color: var(--ink-900);
}

.report1-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.filter-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fffdf9;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

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

.filter-actions button {
  padding: 5px 8px;
  font-size: 12px;
}

.filter-submit-line {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-list {
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  background: #fff;
}

.check-item {
  display: block;
  padding: 4px 2px;
  line-height: 1.35;
}

.forecast {
  white-space: pre-wrap;
  background: #1f2b36;
  color: #f1e8d9;
  border: 1px solid #2d3c4b;
  border-radius: 10px;
  padding: 10px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

th,
td {
  border: 1px solid #d6cab8;
  padding: 6px 8px;
  text-align: left;
}

th {
  position: relative;
  background: var(--sand-100);
  color: var(--ink-900);
}

tr:nth-child(even) td {
  background: #faf7f1;
}

tr:nth-child(odd) td {
  background: #fffdf8;
}

th.vertical-head {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  min-width: 38px;
  height: 150px;
  white-space: nowrap;
  vertical-align: bottom;
}

th.horizontal-head {
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  min-width: 120px;
  height: auto;
  white-space: normal;
  vertical-align: middle;
  padding-top: 18px;
}

th .th-text {
  display: inline-block;
  pointer-events: none;
  transform: rotate(180deg);
}

th.horizontal-head .th-text {
  display: block;
  transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

th .pin-toggle {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #b7a188;
  background: rgba(255, 252, 246, 0.95);
  color: #82603b;
  font-size: 11px;
  line-height: 1;
  writing-mode: horizontal-tb;
  transform: none;
  z-index: 8;
}

th .pin-toggle:hover {
  filter: none;
  background: #f1e4d2;
}

th .pin-toggle.active {
  color: #fff;
  border-color: #85511f;
  background: linear-gradient(135deg, #b77935, #8e5622);
}

th .col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

th .col-resizer:hover {
  background: rgba(159, 107, 47, 0.25);
}

th.is-pinned-header {
  background: #efe5d6;
}

td.is-pinned-cell {
  background: #fffaf1;
}

body.is-resizing-columns {
  user-select: none;
  cursor: col-resize;
}

.auth-wrap {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(520px, 100%);
  background: var(--card-glass-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(8, 12, 16, 0.24);
}

.auth-card h1 {
  margin: 0 0 10px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-900);
}

.auth-link-row {
  margin-top: 12px;
}

.auth-link-row a {
  color: var(--ink-700);
  font-weight: 600;
  text-decoration: none;
}

.auth-link-row a:hover {
  text-decoration: underline;
}

.is-hidden {
  display: none !important;
}

.info {
  margin: 0;
  color: var(--success);
  font-weight: 600;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 900px) {
  body {
    padding: 14px;
  }

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

@media (max-width: 800px) {
  table {
    font-size: 12px;
  }

  th.vertical-head {
    height: 118px;
    min-width: 32px;
  }
}
