@font-face {
  font-family: "Nunito-Sans";
  src: url("/assets/igram/fonts/NunitoSans.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Elza-Text";
  src: url("/assets/igram/fonts/elza-text.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "Elza-semibold";
  src: url("/assets/igram/fonts/elza-semibold.otf") format("opentype");
  font-display: swap;
}

:root {
  --page: #ebebec;
  --surface: #ffffff;
  --surface-soft: #f5f7f8;
  --text: #252525;
  --muted: #45413a;
  --line: #d4d8db;
  --primary: #2f8bbc;
  --primary-strong: #19679c;
  --accent: #ffffff;
  --danger: #9d2f2f;
  --info: #2f8bbc;
  --shadow: 0 18px 38px rgba(69, 65, 58, .08);
  --radius: 2px;
  --font-text: "Nunito-Sans", sans-serif;
  --font-heading: "Elza-semibold", sans-serif;
  --font-link: "Elza-Text", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  background: var(--page);
  color: var(--text);
  line-height: 1.45;
  font-size: 16px;
}

a { color: var(--primary-strong); }
.container {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 92px;
  padding: 0 6%;
  background: var(--primary);
  border-bottom: 4px solid #fff;
}

.appbrand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.appbrand-logo {
  display: block;
  width: 160px;
  height: auto;
}

.appnav {
  display: flex;
  justify-content: center;
  gap: 58px;
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.appnav::-webkit-scrollbar { display: none; }
.appnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  border-radius: 0;
  color: #fff;
  font-family: var(--font-heading);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: .9;
}
.appnav a.active,
.appnav a:hover {
  background: transparent;
  color: #fff;
  opacity: 1;
}

.appnav a.active::after,
.appnav a:hover::after {
  content: "";
  display: block;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 2px;
  background: #fff;
  position: absolute;
}

.app-lang {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255,255,255,.75);
  color: #fff;
  font-family: var(--font-heading);
  font-size: .9rem;
  letter-spacing: 1px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 16px;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 4px;
  font-family: var(--font-heading);
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: .3px;
}
h2 {
  margin-bottom: 14px;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.18rem;
  line-height: 1.2;
}
h3 {
  margin-bottom: 4px;
  font-family: var(--font-heading);
  font-size: 1.06rem;
}
small { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

label {
  display: block;
  margin: 10px 0 5px;
  color: var(--muted);
  font-family: var(--font-heading);
  font-size: .92rem;
  font-weight: 600;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #cbd4da;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35,107,69,.16);
}
input::placeholder { color: #899188; }

.locked-field {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #cbd4da;
  border-radius: var(--radius);
  background: #f7f9fa;
  color: var(--muted);
  font-family: var(--font-text);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s, background .12s, box-shadow .12s;
}
button:hover, .btn:hover {
  background: var(--primary-strong);
  color: #fff;
}
button:active, .btn:active { transform: translateY(1px); }
button[style*="#f59e0b"] { background: #fff !important; color: var(--primary) !important; border: 1px solid var(--primary) !important; }
button[style*="#6a1c1c"],
button[style*="#8b2a2a"] { background: var(--danger) !important; color: #fff !important; }

.link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--primary-strong);
  font-family: var(--font-heading);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .8px;
  text-decoration: none;
  text-transform: uppercase;
}
.link:hover { background: var(--surface-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e8f4fa;
  border: 1px solid #c8e3f1;
  color: var(--primary-strong);
  font-size: .82rem;
  font-weight: 800;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid transparent;
  font-weight: 700;
}
.alert.ok { background: #e8f4fa; color: var(--primary-strong); border-color: #bedfeb; }
.alert.err { background: #fff0f0; color: #842323; border-color: #efcaca; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.col { flex: 1 1 240px; }
.nowrap { white-space: nowrap; }

.project-filter {
  margin-bottom: 14px;
}
.project-filter small {
  display: block;
  margin-top: 6px;
}

.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}
.table thead th {
  background: #f7f9fa;
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
}
.table tbody tr:hover { background: #fbfcfa; }
.table td.actions,
.table th.actions {
  width: 1%;
  white-space: nowrap;
}

.input-with-suffix { position: relative; }
.input-with-suffix > span {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: .9rem;
}
.input-with-suffix > input { padding-right: 34px; }

.flatpickr-calendar { font-size: 16px; }
input[type="text"][data-datepicker],
.flatpickr-input[readonly] {
  min-height: 48px !important;
  padding: 11px 12px !important;
  font-size: 16px !important;
  line-height: 1.2;
  appearance: none;
  border-radius: var(--radius);
}

.quick-entry {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.record-group {
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}
.record-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.quick-entry .time-fields {
  display: grid !important;
  grid-template-columns: minmax(106px, 1fr) 84px 84px minmax(160px, 2fr);
  gap: 8px !important;
  align-items: center;
}
.quick-entry .car-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 140px;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}
.quick-entry input[name="hours"],
.quick-entry input[name="minutes"] {
  width: 100% !important;
}

.time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.quick-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.quick-submit button {
  width: auto;
}
.quick-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.time-presets button {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.time-presets button:hover {
  background: var(--primary);
  color: #fff;
}

:focus-visible {
  outline: 3px solid rgba(47,139,188,.3);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  body { background: var(--page); }
  .appbar {
    min-height: 54px;
    padding: 6px 10px;
    gap: 10px;
  }
  .appbrand-logo {
    width: 94px;
  }
  .appnav {
    margin-left: 0;
    margin-right: 0;
    flex: 1;
    justify-content: flex-start;
    gap: 16px;
  }
  .appnav a {
    min-height: 36px;
    padding: 6px 0;
    font-size: .72rem;
    letter-spacing: .8px;
  }
  .app-lang { display: none; }
  .container {
    padding: 14px 10px 24px;
  }
  .header {
    display: block;
    margin-bottom: 12px;
  }
  .header > div:last-child {
    margin-top: 8px;
  }
  h1 { font-size: 1.34rem; }
  h2 { font-size: 1.04rem; }
  .card {
    padding: 13px;
    margin-bottom: 12px;
    box-shadow: none;
  }
  label {
    margin-top: 8px;
    font-size: .86rem;
  }
  input, select {
    min-height: 46px;
    padding: 10px 11px;
  }
  button, .btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
  }
  .time-presets {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .time-presets button {
    width: 100%;
    min-width: 0;
    padding: 8px 5px;
    font-size: .72rem;
    letter-spacing: .3px;
  }
  .link { min-height: 36px; padding: 6px 8px; }

  .quick-entry .time-fields {
    grid-template-columns: 1fr 74px 74px;
  }
  .quick-entry .time-fields > div:nth-child(4),
  .quick-entry .time-fields > div:nth-child(5) {
    grid-column: 1 / -1;
  }
  .quick-entry .car-fields {
    grid-template-columns: 1fr;
  }
  .quick-submit,
  .quick-actions {
    justify-content: stretch;
  }
  .quick-submit button,
  .quick-actions .btn {
    width: 100%;
  }

  table.table {
    display: block;
    border: 0;
    overflow: visible;
  }
  table.table thead { display: none; }
  table.table tbody { display: block; }
  table.table tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 8px 0;
    padding: 8px;
  }
  table.table td {
    display: block;
    border: 0;
    padding: 5px 6px 5px 6.7rem;
    position: relative;
    min-height: 30px;
  }
  table.table td::before {
    content: attr(data-label);
    position: absolute;
    left: 6px;
    top: 5px;
    max-width: 6rem;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    white-space: nowrap;
  }
  table.table td:not([data-label]) {
    padding-left: 6px;
  }
  table.table td:not([data-label])::before,
  table.table td.actions::before {
    content: '';
  }
  table.table td.actions {
    padding: 8px 0 0;
  }
  table.table td.actions > div {
    gap: 6px !important;
    justify-content: stretch !important;
  }
  table.table td.actions form {
    flex: 1 1 0;
  }
  table.table td.actions button {
    margin: 0 !important;
  }
}

@media (min-width: 701px) and (max-width: 1024px) {
  .container { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
