:root {
  --bg: #f4f8f7;
  --surface: #ffffff;
  --surface-soft: #eaf5f2;
  --text: #17312d;
  --muted: #61736f;
  --primary: #117864;
  --primary-dark: #0a5e4d;
  --accent: #2563eb;
  --danger: #b42318;
  --danger-bg: #ffe8e5;
  --warning: #9a5b00;
  --warning-bg: #fff3d6;
  --success: #137333;
  --success-bg: #e6f4ea;
  --border: #d5e3df;
  --shadow: 0 12px 32px rgba(23, 49, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

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

.top-nav a {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.container {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.page-heading,
.auth-intro {
  margin: 10px 0 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 10px;
  line-height: 1.15;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

.panel,
.auth-card,
.scanner-panel,
.room-summary,
.table-panel,
.log-card,
.room-card,
.stat-card,
.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.auth-card,
.scanner-panel,
.room-summary,
.table-panel {
  padding: 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.form-card,
.inline-form,
#usage-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  outline: 3px solid rgba(17, 120, 100, 0.18);
  border-color: var(--primary);
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  background: var(--primary-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-full {
  width: 100%;
}

.button-secondary {
  background: var(--accent);
}

.button-secondary:hover {
  background: #1d4ed8;
}

.button-light {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

.button-light:hover {
  background: #d7ebe5;
}

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
}

.demo-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.demo-box p {
  margin: 4px 0;
}

.login-hub {
  max-width: 760px;
  margin-inline: auto;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.login-tab {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--primary-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.login-tab.is-active {
  background: #fff;
  box-shadow: 0 6px 16px rgba(23, 49, 45, 0.1);
}

.login-panel {
  display: none;
}

.login-panel.is-active {
  display: block;
}

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

.staff-card {
  position: relative;
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 164px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.staff-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.staff-card img {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  object-fit: cover;
  background: var(--surface-soft);
}

.staff-card span {
  font-weight: 800;
}

.staff-card.is-selected,
.staff-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--surface-soft);
  box-shadow: 0 0 0 3px rgba(17, 120, 100, 0.14);
}

.scanner-box {
  overflow: hidden;
  min-height: 280px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #10221f;
}

.scanner-message {
  margin-top: 12px;
  color: var(--muted);
  font-weight: 700;
}

.scanner-message.error {
  color: var(--danger);
}

.scanner-message.success {
  color: var(--success);
}

.room-summary dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 14px 0 0;
}

.room-summary dl div {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

dd {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 800;
}

.material-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfc;
}

.material-card-row {
  gap: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f4fbf8 100%);
}

.material-choice-block {
  display: grid;
  gap: 12px;
}

.row-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.selected-material-text {
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 800;
}

.usage-floor-select {
  max-width: 260px;
}

.stock-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.material-choice {
  display: grid;
  min-height: 158px;
  gap: 7px;
  align-content: start;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.material-choice img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-soft);
}

.material-choice span {
  font-weight: 800;
}

.material-choice small {
  color: var(--muted);
  font-size: 12px;
}

.material-choice.is-selected {
  border-color: var(--primary);
  background: var(--surface-soft);
  box-shadow: 0 0 0 3px rgba(17, 120, 100, 0.14);
}

.usage-row-controls {
  display: grid;
  grid-template-columns: 1fr 100px 48px;
  gap: 10px;
  align-items: end;
}

.unit-display {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.unit-display span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.unit-display strong {
  font-size: 18px;
}

.form-actions {
  display: grid;
  gap: 10px;
}

.confirm-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 6px -18px -18px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -12px 28px rgba(23, 49, 45, 0.08);
}

.button-confirm {
  min-height: 58px;
  background: #0f6b57;
  font-size: 18px;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(17, 120, 100, 0.24);
}

.button-confirm:hover {
  background: #084c3e;
}

.icon-label-button {
  gap: 9px;
}

.plus-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  font-size: 22px;
  line-height: 1;
}

.icon-action {
  width: 48px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.stats-grid,
.action-grid,
.room-grid,
.log-list,
.user-admin-grid {
  display: grid;
  gap: 14px;
}

.stat-card,
.action-card,
.room-card,
.log-card,
.user-admin-card {
  padding: 16px;
}

.stat-card span,
.action-card span {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 32px;
}

.stat-card.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.action-card {
  display: grid;
  gap: 5px;
  text-decoration: none;
}

.action-card strong {
  font-size: 18px;
}

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

.stock-tools-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.compact-tool-panel {
  margin-bottom: 0;
}

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

.form-help {
  margin: -2px 0 0;
  font-size: 13px;
}

.responsive-table thead {
  display: none;
}

.responsive-table tr {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.responsive-table tr:last-child {
  border-bottom: 0;
}

.responsive-table td {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.responsive-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-weight: 700;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.status-ok {
  background: var(--success-bg);
  color: var(--success);
}

.status-low {
  background: var(--warning-bg);
  color: var(--warning);
}

.stock-thumb {
  width: 54px;
  height: 42px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.stock-table input[type="text"],
.stock-table input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 9px;
}

.stock-table td[data-label="Malzeme"] input[type="text"] {
  min-width: 0;
}

.image-upload-form {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.file-button-full {
  width: 100%;
}

.stock-table .button,
.stock-table .file-button {
  min-height: 38px;
  padding-block: 8px;
  font-size: 14px;
}

.file-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 800;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.user-admin-card {
  display: grid;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.user-admin-head {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 13px;
  align-items: center;
}

.user-admin-head img {
  width: 78px;
  height: 78px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.user-admin-head h2 {
  margin-bottom: 4px;
}

.user-edit-form,
.avatar-upload-form {
  display: grid;
  gap: 12px;
}

.avatar-upload-form {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.log-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.log-meta {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
}

.log-meta span {
  color: var(--muted);
}

.room-card {
  display: grid;
  gap: 14px;
}

.qr-code {
  display: grid;
  min-height: 204px;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.qr-code img,
.qr-code canvas {
  width: 180px;
  height: 180px;
}

.qr-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.general-qr-panel {
  display: grid;
  gap: 16px;
}

.room-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.room-card h2 {
  margin-bottom: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (min-width: 720px) {
  .container {
    padding-top: 28px;
  }

  h1 {
    font-size: 40px;
  }

  .inline-form {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
    align-items: end;
  }

  .stock-tools-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .compact-form {
    grid-template-columns: minmax(180px, 1fr) minmax(120px, 180px) auto;
    align-items: end;
  }

  .compact-tool-panel .form-help {
    grid-column: 1 / -1;
  }

  .room-summary dl,
  .stats-grid,
  .action-grid,
  .room-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .general-qr-panel {
    grid-template-columns: 1fr 240px;
    align-items: start;
  }

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

  .material-row {
    grid-template-columns: 1.4fr 160px 120px auto;
    align-items: end;
  }

  .material-card-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .form-actions {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .responsive-table thead {
    display: table-header-group;
  }

  .responsive-table tr {
    display: table-row;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .responsive-table th,
  .responsive-table td {
    display: table-cell;
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .stock-table th,
  .stock-table td {
    padding: 8px;
    vertical-align: middle;
  }

  .stock-table {
    min-width: 980px;
  }

  .stock-thumb {
    width: 64px;
    height: 48px;
  }

  .stock-table th:nth-child(1),
  .stock-table td:nth-child(1) {
    width: 76px;
  }

  .stock-table th:nth-child(2),
  .stock-table td:nth-child(2) {
    min-width: 220px;
  }

  .stock-table th:nth-child(3),
  .stock-table td:nth-child(3) {
    width: 92px;
  }

  .stock-table th:nth-child(4),
  .stock-table td:nth-child(4),
  .stock-table th:nth-child(5),
  .stock-table td:nth-child(5) {
    width: 112px;
  }

  .stock-table th:nth-child(6),
  .stock-table td:nth-child(6),
  .stock-table th:nth-child(7),
  .stock-table td:nth-child(7) {
    width: 96px;
  }

  .stock-table th:nth-child(8),
  .stock-table td:nth-child(8) {
    width: 128px;
  }

  .responsive-table td::before {
    content: none;
  }
}
