:root {
  color-scheme: light;
  --ink: #102333;
  --muted: #617383;
  --line: #cbd8df;
  --panel: #ffffff;
  --soft: #eaf5f9;
  --brand: #223241;
  --blue: #5bc3e9;
  --blue-strong: #2daee0;
  --good: #2c8f63;
  --warn: #b86b1e;
  --bad: #b94a48;
  --shadow: 0 18px 38px rgba(34, 50, 65, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  background: #edf5f8;
  color: var(--ink);
}

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

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

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

.driver-mode .office-only {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(34, 50, 65, 0.94), rgba(34, 50, 65, 0.76)),
    url("assets/emblem.png") center 12% / 260px auto no-repeat;
}

.login-card {
  width: min(100%, 390px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-card img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.15;
}

h2 {
  font-size: 1.65rem;
  margin-bottom: 0;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0;
}

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

.remember-login {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 9px;
}

.remember-login input {
  min-height: 18px;
  width: 18px;
}

.login-message {
  color: var(--bad);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 18px;
}

.login-mode-panel {
  align-items: center;
  background: var(--soft);
  border: 1px solid #b9dceb;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  margin: 14px 0;
  padding: 11px;
}

.login-mode-panel span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-mode-panel strong {
  font-size: 1.1rem;
}

.mode-switch-button {
  background: #fff;
  border: 1px solid #b9dceb;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  margin-top: 5px;
  min-height: 36px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bfcdd4;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  min-height: 46px;
}

textarea {
  resize: vertical;
}

.primary-button,
.text-button,
.icon-button,
.quick-grid button,
.segmented button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
}

.primary-button {
  background: var(--blue-strong);
  color: #fff;
  font-weight: 900;
  padding: 0 16px;
}

.primary-button.small {
  min-height: 36px;
  padding: 0 12px;
}

.text-button {
  background: transparent;
  color: var(--blue-strong);
  font-weight: 900;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  background: #f6fbfd;
  border-color: #c7d7df;
  color: var(--ink);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 22px rgba(16, 35, 51, 0.22);
}

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

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

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #bde9f7;
  font-size: 0.74rem;
}

.content {
  padding: 18px 14px 10px;
  max-width: 740px;
  margin: 0 auto;
}

.section-title {
  margin-bottom: 14px;
}

.row-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi,
.panel,
.list-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(34, 50, 65, 0.08);
}

.kpi {
  padding: 12px;
  border-left: 4px solid var(--blue);
}

.kpi span,
.meta {
  color: var(--muted);
  font-size: 0.77rem;
}

.kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 1.28rem;
}

.panel {
  padding: 14px;
  margin-bottom: 14px;
}

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

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

.quick-grid button {
  background: var(--soft);
  border-color: #b9dceb;
  color: var(--ink);
  font-weight: 900;
}

.search {
  margin-bottom: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  margin-bottom: 12px;
  background: #dcebf0;
  border-radius: 8px;
}

.segmented button {
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segmented button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(34, 50, 65, 0.1);
}

.list {
  display: grid;
  gap: 10px;
}

.list-card {
  display: grid;
  gap: 7px;
  padding: 13px;
}

.list-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.list-card strong {
  font-size: 1rem;
}

.amount {
  white-space: nowrap;
  font-weight: 900;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef4f6;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.badge.good {
  background: #e3f5ec;
  color: var(--good);
}

.badge.warn {
  background: #fff1dc;
  color: var(--warn);
}

.badge.bad {
  background: #fae8e7;
  color: var(--bad);
}

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

.card-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #c7d7df;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.driver-route {
  background: #f3f8fa;
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  display: grid;
  gap: 5px;
  padding: 9px 10px;
}

.driver-route span {
  display: block;
  font-size: 0.8rem;
}

.driver-route strong {
  display: inline-block;
  font-size: 0.73rem;
  min-width: 66px;
}

.driver-tour-details {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.driver-tour-details span {
  color: var(--muted);
  font-size: 0.76rem;
}

.driver-attachment-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 5px;
  padding-top: 8px;
}

.driver-attachment-list span {
  color: var(--muted);
  font-size: 0.74rem;
}

.driver-status-actions button[data-driver-status="Erledigt"] {
  background: #e3f5ec;
  border-color: #b8dfcc;
  color: var(--good);
}

.driver-status-actions button[data-driver-status="Unterwegs"] {
  background: #fff1dc;
  border-color: #f1ca8a;
  color: var(--warn);
}

.driver-upload-button {
  background: #e3f5fc !important;
  border-color: #b9dceb !important;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(34, 50, 65, 0.97);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bottom-nav button {
  min-width: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7dce5;
  padding: 6px 2px;
  font-size: 0.68rem;
  font-weight: 800;
}

.bottom-nav button.active {
  background: rgba(91, 195, 233, 0.18);
  color: #fff;
}

.bottom-nav svg,
.bottom-nav span {
  display: block;
  margin: 0 auto;
}

.bottom-nav svg {
  width: 19px;
  height: 19px;
  margin-bottom: 3px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 35, 51, 0.42);
}

.sheet {
  position: fixed;
  z-index: 21;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(92vh - env(safe-area-inset-top));
  overflow: auto;
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 42px rgba(16, 35, 51, 0.28);
}

.sheet-handle {
  width: 44px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: #b8c9d0;
}

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

.document-viewer {
  background: #edf5f8;
  display: grid;
  grid-template-rows: auto 1fr;
  inset: 0;
  position: fixed;
  z-index: 30;
}

.document-viewer header {
  align-items: center;
  background: var(--brand);
  color: #fff;
  display: flex;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}

.document-viewer iframe {
  background: #fff;
  border: 0;
  height: 100%;
  width: 100%;
}

body.viewer-open {
  overflow: hidden;
}

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

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

.calculator-result-grid article {
  background: var(--soft);
  border: 1px solid #b9dceb;
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 11px;
}

.calculator-result-grid span,
.calculator-recommendation {
  color: var(--muted);
  font-size: 0.78rem;
}

.calculator-result-grid strong {
  font-size: 1.16rem;
}

.calculator-recommendation {
  background: #e3f5fc;
  border: 1px solid #b9dceb;
  border-radius: 8px;
  line-height: 1.45;
  margin-top: 10px;
  padding: 10px;
}

.calculator-recommendation.is-warning {
  background: #fff1dc;
  border-color: #f1ca8a;
  color: #855313;
}

.mobile-loading-stage {
  align-items: center;
  display: flex;
  justify-content: center;
  overflow: auto;
  padding: 4px 0 12px;
}

.mobile-loading-space {
  background:
    linear-gradient(rgba(91, 195, 233, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 195, 233, 0.16) 1px, transparent 1px),
    #f8fcfd;
  background-size: 20px 20px;
  border: 2px solid #617383;
  min-height: 150px;
  min-width: 112px;
  overflow: hidden;
  position: relative;
}

.mobile-cargo {
  align-items: center;
  border: 1px solid rgba(16, 35, 51, 0.56);
  color: #102333;
  display: flex;
  font-size: 0.63rem;
  font-weight: 900;
  justify-content: center;
  line-height: 1.1;
  overflow: hidden;
  padding: 2px;
  position: absolute;
  text-align: center;
  background: #5bc3e9;
}

.mobile-cargo:nth-child(even) {
  background: #ffbe55;
}

.mobile-loading-empty {
  color: var(--muted);
  display: grid;
  font-size: 0.75rem;
  height: 100%;
  padding: 16px;
  place-items: center;
  text-align: center;
}

#mobile-loading-status {
  margin-top: 7px;
}

#mobile-loading-status.bad {
  color: var(--bad);
  font-weight: 800;
}

.empty {
  color: var(--muted);
  padding: 20px 6px;
  text-align: center;
}

@media (min-width: 720px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

  .bottom-nav button {
    font-size: 0.61rem;
  }
}
