:root {
  --ink: #162033;
  --muted: #687385;
  --line: #dfe6ee;
  --panel: #ffffff;
  --soft: #f4f7fa;
  --accent: #0f7c68;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Helvetica, sans-serif;
}

.hidden { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f4f7fa, #e5efe9);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(22, 32, 51, 0.12);
}

.login-card h1 { margin: 0; }

.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 10px;
  background: #111c2e;
  color: white;
}

.sidebar strong {
  margin-bottom: 18px;
  font-size: 20px;
}

.sidebar a,
.sidebar button {
  min-height: 42px;
  padding: 10px 12px;
  color: white;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  text-align: left;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.sidebar .active {
  background: var(--accent);
  border-color: var(--accent);
}

.workspace {
  padding: 24px;
}

.workspace-head {
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.workspace-head h1 {
  margin: 0 0 4px;
}

.tab-panel {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(22, 32, 51, 0.05);
}

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

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

.compact-grid h2 {
  grid-column: 1 / -1;
}

h2,
h3 {
  margin: 0 0 8px;
}

.muted,
.message,
small {
  color: var(--muted);
}

input,
textarea,
select,
button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

button {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.secondary {
  color: var(--ink) !important;
  background: #eef3f6 !important;
  border-color: var(--line) !important;
  text-align: center !important;
}

.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.check,
.mini-check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check input,
.mini-check input {
  width: 18px;
  min-height: 18px;
}

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

.upload-box {
  padding: 14px;
  display: grid;
  gap: 8px;
  border: 1px dashed #b7c6d4;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.photo-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.photo-preview img {
  width: 92px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.item-row {
  padding: 14px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.item-row:first-child {
  border-top: 0;
}

.item-row span,
.item-row small {
  display: block;
  margin-top: 4px;
}

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

.row-actions button {
  width: auto;
  min-width: 80px;
}

.table-wrap {
  overflow-x: auto;
}

.inventory-toolbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 180px 120px 120px 140px;
  gap: 10px;
  align-items: end;
}

#inventoryTable {
  grid-column: 1 / -1;
}

.inventory-head {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.inventory-head h2 {
  margin: 0;
}

.inventory-chart {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-row {
  min-width: 1220px;
  display: grid;
  grid-template-columns: 220px repeat(8, minmax(118px, 1fr));
  border-bottom: 1px solid var(--line);
}

.chart-row:last-child {
  border-bottom: 0;
}

.chart-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4f7;
  font-weight: 700;
}

.chart-room,
.chart-date,
.chart-cell {
  min-height: 102px;
  padding: 10px;
  border-right: 1px solid var(--line);
}

.chart-room {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
}

.chart-header .chart-room {
  background: #eef4f7;
}

.chart-room small {
  display: block;
  margin-top: 5px;
}

.chart-date {
  min-height: 48px;
  display: grid;
  place-items: center;
}

.chart-cell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: #fbfcfd;
}

.chart-cell input,
.chart-cell button {
  width: 100%;
  min-height: 34px;
  padding: 6px 7px;
  font-size: 13px;
}

.chart-cell .inv-input {
  grid-column: 1 / -1;
  font-weight: 700;
  border-color: #a9bfd2;
}

.rate-field {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rate-field span {
  line-height: 1;
}

.chart-cell button {
  grid-column: 1 / -1;
  min-height: 32px;
  font-size: 12px;
}

.villa-block {
  grid-template-columns: 1fr;
  place-items: center;
  color: var(--danger);
  background: #fff1f0;
  font-weight: 700;
  text-align: center;
}

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

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

@media (max-width: 980px) {
  .admin-app,
  .tab-panel,
  .compact-grid,
  .inventory-toolbar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 14px;
  }

  .workspace-head,
  .item-row {
    display: grid;
  }

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