:root {
  --bg: #f2f2f4;
  --card: #ffffff;
  --text: #111214;
  --muted: #777b82;
  --line: #e4e5e8;
  --dark: #0f0f10;
  --accent: #111214;
  --blue: #2f70ff;
  --orange: #ef8a22;
  --red: #df3f4d;
  --green: #2f9f62;
  --purple: #805ad5;
  --shadow: 0 10px 30px rgba(0,0,0,.07);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100dvh; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-end;
  min-height: 92px; padding: calc(15px + env(safe-area-inset-top)) 18px 14px;
  background: rgba(242,242,244,.92); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(0,0,0,.04);
}
.brand-kicker { font-size: 11px; font-weight: 800; letter-spacing: .16em; color: var(--muted); }
h1 { margin: 3px 0 0; font-size: clamp(29px, 8vw, 40px); line-height: 1; letter-spacing: -.04em; }
.icon-button {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--dark); color: white; font-size: 30px; line-height: 1;
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.screen { width: min(100%, 880px); margin: 0 auto; padding: 15px 14px 30px; }
.bottom-nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 7px 5px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.95); backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.nav-item { border: 0; background: transparent; color: #81838a; padding: 2px 1px; font-size: 10px; font-weight: 650; }
.nav-item span { display: block; }
.nav-icon { font-size: 22px; line-height: 25px; min-height: 25px; }
.nav-item.active { color: var(--text); }
.nav-item.active .nav-icon { transform: translateY(-1px); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px; margin-bottom: 12px; }
.card.compact { padding: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 18px 2px 9px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-head button { border: 0; background: transparent; font-weight: 750; color: var(--blue); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.quick-action { text-align: left; min-height: 88px; border: 0; border-radius: 17px; padding: 14px; background: var(--card); box-shadow: var(--shadow); }
.quick-action strong { display: block; font-size: 16px; margin-bottom: 5px; }
.quick-action small { color: var(--muted); line-height: 1.3; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.metric { background: var(--card); border-radius: 16px; padding: 13px 10px; box-shadow: var(--shadow); }
.metric .value { font-size: 25px; font-weight: 850; letter-spacing: -.04em; }
.metric .label { margin-top: 3px; color: var(--muted); font-size: 11px; }
.list { display: grid; gap: 9px; }
.list-item { display: flex; gap: 11px; align-items: flex-start; padding: 13px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 15px; font-weight: 760; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.list-meta { font-size: 12px; font-weight: 750; white-space: nowrap; color: var(--muted); }
.dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--blue); }
.dot.orange { background: var(--orange); }
.dot.red { background: var(--red); }
.dot.green { background: var(--green); }
.dot.purple { background: var(--purple); }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.primary, .secondary, .danger, .ghost { min-height: 44px; border-radius: 13px; padding: 10px 14px; font-weight: 760; border: 0; }
.primary { background: var(--dark); color: white; }
.secondary { background: #e9eaed; color: var(--text); }
.danger { background: #ffe7ea; color: #b92738; }
.ghost { background: transparent; color: var(--blue); padding-inline: 4px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.button-row > * { flex: 1 1 auto; }
.search { width: 100%; min-height: 45px; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 0 14px; outline: none; margin-bottom: 12px; }
.search:focus, input:focus, textarea:focus, select:focus { border-color: #a9adb4; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: #eceef1; font-size: 11px; font-weight: 750; color: #5f6269; }
.pill.done { background: #dcf5e6; color: #217544; }
.pill.wait { background: #fff0db; color: #a45b0b; }
.pill.extra { background: #f0e7ff; color: #6941b7; }
.progress-track { height: 9px; background: #e7e8eb; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--dark); border-radius: inherit; }
.progress-caption { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 2px 13px; }
.calendar-month { font-size: 31px; font-weight: 850; letter-spacing: -.04em; text-transform: capitalize; }
.calendar-controls { display: flex; gap: 6px; }
.calendar-controls button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: white; box-shadow: var(--shadow); font-size: 18px; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekdays { color: var(--muted); font-size: 11px; font-weight: 750; text-align: center; padding-bottom: 6px; }
.calendar-grid { background: white; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.day-cell { position: relative; min-height: 66px; border-right: 1px solid #f0f1f2; border-bottom: 1px solid #f0f1f2; padding: 7px 5px; background: white; text-align: center; }
.day-cell:nth-child(7n) { border-right: 0; }
.day-cell.outside { color: #c0c1c5; background: #fafafa; }
.day-cell.selected { background: #f0f1f3; }
.day-number { width: 29px; height: 29px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 650; }
.day-cell.today .day-number { background: var(--dark); color: white; }
.event-dots { display: flex; justify-content: center; gap: 3px; margin-top: 5px; min-height: 5px; }
.event-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.day-count { margin-top: 3px; font-size: 9px; color: var(--muted); }
.day-agenda { margin-top: 15px; }
.agenda-date { font-size: 20px; font-weight: 820; margin: 0 2px 10px; text-transform: capitalize; }
.client-card, .investment-card, .estimate-card { cursor: pointer; }
.client-card:active, .investment-card:active, .estimate-card:active { transform: scale(.99); }
.detail-title { font-size: 25px; font-weight: 850; letter-spacing: -.035em; margin: 3px 0 5px; }
.detail-sub { color: var(--muted); margin-bottom: 15px; }
.check-row { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 9px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-button { width: 29px; height: 29px; border-radius: 50%; border: 2px solid #bfc2c7; background: white; font-size: 17px; font-weight: 900; }
.check-row.done .check-button { background: var(--dark); border-color: var(--dark); color: white; }
.check-row.done .check-title { text-decoration: line-through; color: var(--muted); }
.check-title { font-weight: 730; line-height: 1.3; }
.check-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.check-section { color: var(--muted); font-size: 10px; font-weight: 780; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.tabs { display: flex; gap: 5px; background: #e5e6e9; padding: 4px; border-radius: 13px; margin-bottom: 12px; }
.tabs button { flex: 1; border: 0; border-radius: 10px; padding: 8px 6px; background: transparent; font-size: 12px; font-weight: 760; color: var(--muted); }
.tabs button.active { background: white; color: var(--text); box-shadow: 0 2px 7px rgba(0,0,0,.08); }
.note-entry { padding: 13px 0; border-bottom: 1px solid var(--line); }
.note-entry:last-child { border-bottom: 0; }
.note-date { color: var(--muted); font-size: 11px; font-weight: 750; }
.note-category { display: inline-block; margin-left: 7px; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--purple); }
.note-content { white-space: pre-wrap; margin-top: 6px; font-size: 14px; line-height: 1.45; }
.quote-total { padding: 17px; border-radius: 18px; background: var(--dark); color: white; margin-bottom: 12px; }
.quote-total small { color: #b8b8bc; }
.quote-range { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-top: 12px; }
.quote-range > div { background: #252527; border-radius: 13px; padding: 11px 8px; }
.quote-range strong { display: block; font-size: 17px; margin-top: 3px; }
.quote-line { display: grid; grid-template-columns: minmax(0,1fr) 64px 84px 33px; gap: 7px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.quote-line input { width: 100%; min-height: 39px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
.quote-line button { width: 31px; height: 31px; border: 0; border-radius: 50%; background: #f3f3f5; color: var(--red); }
.quote-line-name { font-size: 13px; font-weight: 720; }
.range-caption { font-size: 10px; color: var(--muted); margin-top: 2px; }
.setting-row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row label { display: block; font-size: 12px; font-weight: 760; margin-bottom: 6px; }
.setting-row input, .setting-row select, .setting-row textarea,
.form-field input, .form-field select, .form-field textarea {
  width: 100%; min-height: 45px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: white; outline: none;
}
textarea { resize: vertical; min-height: 90px !important; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.42); }
.modal { width: min(100%, 680px); max-height: min(91dvh, 850px); overflow: auto; background: var(--bg); border-radius: 25px 25px 0 0; padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 60px rgba(0,0,0,.2); }
.modal-handle { width: 45px; height: 5px; border-radius: 99px; background: #c5c6ca; margin: 2px auto 12px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.modal-head h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.close-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #e2e3e6; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.form-field label { display: block; font-size: 12px; font-weight: 760; margin: 0 0 5px 2px; }
.form-actions { position: sticky; bottom: 0; display: flex; gap: 8px; padding-top: 12px; background: linear-gradient(transparent, var(--bg) 20%); }
.form-actions button { flex: 1; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 15px; border-radius: 999px; background: #111; color: white; font-size: 13px; transition: .22s; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.inline-link { color: var(--blue); text-decoration: none; font-weight: 720; }
.small-muted { color: var(--muted); font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.fab { position: fixed; right: 18px; bottom: calc(87px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--dark); color: white; font-size: 31px; box-shadow: 0 14px 35px rgba(0,0,0,.24); z-index: 19; }
.hidden { display: none !important; }
@media (min-width: 700px) {
  .screen { padding-inline: 22px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .metric-grid { grid-template-columns: repeat(5, 1fr); }
  .form-grid.two { grid-template-columns: repeat(2, 1fr); }
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 25px; }
  .bottom-nav { left: 50%; transform: translateX(-50%); width: min(100%, 880px); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; }
}
@media (max-width: 380px) {
  .nav-item { font-size: 9px; }
  .nav-icon { font-size: 20px; }
  .day-cell { min-height: 57px; padding-inline: 2px; }
  .quote-line { grid-template-columns: minmax(0,1fr) 55px 74px 30px; }
}
.event-dot.red { background: var(--red); }
.event-dot.orange { background: var(--orange); }
.event-dot.green { background: var(--green); }
.event-dot.purple { background: var(--purple); }


/* HG Elektryk Online 0.2 */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 15% 10%, rgba(47,112,255,.12), transparent 32%),
    var(--bg);
}
.auth-card {
  width: min(100%, 460px);
  background: var(--card);
  border-radius: 26px;
  box-shadow: 0 18px 60px rgba(0,0,0,.11);
  padding: 22px;
}
.auth-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--dark);
  color: white;
  font-size: 21px;
  font-weight: 900;
  margin-bottom: 17px;
}
.auth-card h1 {
  font-size: 30px;
  margin: 0 0 7px;
}
.auth-card p {
  color: var(--muted);
  line-height: 1.5;
}
.auth-card .form-field {
  margin-top: 12px;
}
.auth-card .primary,
.auth-card .secondary {
  width: 100%;
  margin-top: 10px;
}
.auth-message {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: #eef3ff;
  color: #234c9b;
  font-size: 13px;
  line-height: 1.4;
}
.auth-message.error {
  background: #ffe9ec;
  color: #9b2030;
}
.auth-help {
  margin-top: 15px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.sync-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 14px;
}
.sync-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #aeb1b7;
}
.sync-indicator.ok { background: var(--green); }
.sync-indicator.working { background: var(--orange); }
.sync-indicator.error { background: var(--red); }
.account-email {
  font-weight: 760;
  overflow-wrap: anywhere;
}


.sync-count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.sync-count-grid > div {
  background: var(--soft);
  border-radius: 13px;
  padding: 10px 6px;
  text-align: center;
}
.sync-count-grid strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}
.sync-count-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
@media (max-width: 420px) {
  .sync-count-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
