:root {
  --primary: #0d47a1;
  --primary-d: #08306f;
  --primary-l: #e3edfb;
  --accent: #e65100;
  --bg: #f3f5f9;
  --card: #fff;
  --text: #1c2733;
  --muted: #6b7785;
  --border: #dde3ec;
  --ok: #2e7d32;
  --warn: #f9a825;
  --err: #c62828;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(13, 40, 90, 0.12);
  --hdr: 56px;
  --side: 220px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font:
    14px/1.45 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1 {
  font-size: 22px;
  margin: 0;
}
h2 {
  font-size: 17px;
  margin: 0 0 10px;
}
h3 {
  font-size: 15px;
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
[hidden] {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.right {
  text-align: right;
}
.boot-loading,
.loading {
  display: flex;
  justify-content: center;
  padding: 60px;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid var(--primary-l);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover {
  background: #f0f3f8;
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover {
  background: var(--primary-d);
}
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.danger {
  color: var(--err);
  border-color: #e6b8b8;
}
.btn.danger:hover {
  background: #fdecec;
}
.btn.sm {
  padding: 3px 9px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* header */
.hdr {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hdr);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  z-index: 50;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.hdr .brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.3px;
  color: #fff;
}
.hdr .brand b {
  color: #ffb074;
}
.hdr .spacer {
  flex: 1;
}
.hdr .burger {
  display: none;
  background: none;
  border: 0;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}
.langs {
  display: flex;
  gap: 2px;
}
.langs button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.langs button.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
}
.bell {
  position: relative;
  background: none;
  border: 0;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}
.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
}
.userbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: 0;
  color: #fff;
  text-align: right;
  line-height: 1.1;
}
.userbox small {
  display: block;
  opacity: 0.8;
  font-size: 11px;
}
.hdr .btn {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}
.hdr .btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* layout */
.side {
  position: fixed;
  top: var(--hdr);
  bottom: 0;
  left: 0;
  width: var(--side);
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow: auto;
  z-index: 40;
  transition: transform 0.2s;
}
.side a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text);
  margin-bottom: 2px;
}
.side a:hover {
  background: var(--primary-l);
  text-decoration: none;
}
.side a.active {
  background: var(--primary);
  color: #fff;
}
.main {
  margin: var(--hdr) 0 0 var(--side);
  padding: 20px;
  min-height: calc(100vh - var(--hdr));
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.page-head .grow {
  flex: 1;
}
.crumbs {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

/* forms */
input[type='text'],
input[type='password'],
input[type='email'],
input[type='tel'],
input[type='date'],
input[type='time'],
input[type='number'],
input[type='search'],
select,
textarea {
  width: 100%;
  border: 1px solid #c5cedb;
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
}
.toolbar input,
.toolbar select {
  width: auto;
  min-width: 150px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #90b4ee;
  border-color: var(--primary);
}
textarea {
  min-height: 80px;
  resize: vertical;
}
label.f {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
label.f > input,
label.f > select,
label.f > textarea {
  margin-top: 3px;
  font-weight: 400;
  color: var(--text);
}
label.f.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  font-weight: 400;
}
label.f.chk input {
  width: auto;
}
.frow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.ferr {
  color: var(--err);
  font-size: 13px;
  margin: 6px 0;
  white-space: pre-line;
}

/* tables */
.tbl-wrap {
  overflow-x: auto;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.tbl th,
.tbl td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  background: #fafbfd;
}
.tbl tr:hover td {
  background: #f8fafd;
}
.actions {
  white-space: nowrap;
  text-align: right;
}
/* users table: four actions (edit, picture, reset password, delete) wrap instead of forcing a sideways scroll */
.tbl td.actions {
  white-space: normal;
  min-width: 190px;
  max-width: 240px;
}
.tbl td.actions .btn {
  margin: 2px 0;
}

/* chips / dots */
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}
.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #e8ecf2;
  color: #37475a;
  white-space: nowrap;
}
.chip.PLANNED {
  background: #e3edfb;
  color: #0d47a1;
}
.chip.ACTIVE,
.chip.IN_PROGRESS {
  background: #e0f2e1;
  color: #1b5e20;
}
.chip.DONE {
  background: #eceff1;
  color: #546e7a;
}
.chip.ARCHIVED,
.chip.CANCELLED {
  background: #f3e5e5;
  color: #8d4a4a;
}
.chip.OPEN {
  background: #fff3e0;
  color: #bf5b00;
}
.chip.wt {
  color: #fff;
}
.prio-1 {
  color: var(--err);
  font-weight: 700;
}
.prio-2 {
  color: var(--primary);
}
.prio-3 {
  color: var(--muted);
}
.mention {
  background: #fff1e0;
  color: var(--accent);
  font-weight: 600;
  border-radius: 4px;
  padding: 0 3px;
}

/* project cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.pcard {
  display: block;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  color: var(--text);
  border-left: 6px solid var(--primary);
}
.pcard:hover {
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(13, 40, 90, 0.2);
}
.pcard .top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.pcard .code {
  font-size: 12px;
  color: var(--muted);
}
.pcard .name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}
.pcard .meta {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pcard .acts {
  margin-top: 10px;
  display: flex;
  gap: 6px;
}
.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 20px;
}
.kv div span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}

/* timeline */
.entry {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  border-left: 5px solid var(--primary);
}
.entry .head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 6px;
}
.entry .comment {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0;
}
.entry .loc {
  font-size: 12px;
  color: var(--muted);
}
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.gitem {
  position: relative;
}
.gitem img,
.gitem video {
  width: 130px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  background: #222;
  display: block;
}
.gitem video {
  width: 220px;
  height: 130px;
  cursor: default;
}
.gitem .del {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(198, 40, 40, 0.9);
  color: #fff;
  border: 0;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  line-height: 20px;
  padding: 0;
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}
.lightbox .x {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 34px;
  color: #fff;
  cursor: pointer;
  background: none;
  border: 0;
}

/* modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.5);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 12px;
  overflow: auto;
}
.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal header button {
  background: none;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
}
.modal .body {
  padding: 16px 18px;
}
.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.toast-root {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #263238;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  max-width: 340px;
}
.toast.err {
  background: var(--err);
}
.alert {
  background: #fdecec;
  color: var(--err);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  white-space: pre-line;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px;
}

/* tasks */
.tgroup h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.task {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  background: #fff;
}
.task.dragging {
  opacity: 0.4;
}
.task.over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffd0b0;
}
.task .grip {
  cursor: grab;
  color: var(--muted);
  user-select: none;
  padding-top: 2px;
}
.task .tb {
  flex: 1;
  min-width: 0;
}
.task .tt {
  font-weight: 600;
}
.task.done .tt {
  text-decoration: line-through;
  color: var(--muted);
}
.task .tm {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 3px;
}
.task .ta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.task .ta .row {
  display: flex;
  gap: 4px;
}
.overdue {
  color: var(--err);
  font-weight: 600;
}

/* notifications */
.notif {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.notif.unread {
  background: #fff8ef;
  border-left: 4px solid var(--accent);
}
.notif .nb {
  flex: 1;
  min-width: 0;
}
.notif .nt {
  font-weight: 600;
}

/* calendar */
.cal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cal-head h2 {
  margin: 0;
  min-width: 170px;
  text-align: center;
}
.cal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.cal-inner {
  min-width: 720px;
}
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  text-align: center;
}
.cal-dow div {
  padding: 6px;
}
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}
.cal-cell {
  grid-row: 1/-1;
  border-right: 1px solid var(--border);
  position: relative;
  padding: 0 3px 4px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  overflow: hidden;
}
.cal-cell.other {
  background: #f7f8fa;
  color: #a5adb8;
}
.cal-cell.today {
  background: #fff8ef;
}
.cal-cell .dn {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 12px;
  font-weight: 600;
}
.cal-cell.today .dn {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
}
.cal-bar {
  z-index: 1;
  margin: 1px 2px;
  height: 20px;
  line-height: 20px;
  font-size: 11px;
  color: #fff;
  padding: 0 6px;
  border-radius: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  text-decoration: none !important;
}
.cal-bar.cl {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: 0;
}
.cal-bar.cr {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: 0;
}
.cal-badge {
  font-size: 10px;
  color: #fff;
  border-radius: 8px;
  padding: 0 6px;
  display: inline-block;
  margin-right: 2px;
}
.cal-task {
  font-size: 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #fff;
}
.cal-task.DONE {
  opacity: 0.5;
  text-decoration: line-through;
}

/* login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), #1565c0);
  padding: 16px;
}
.login {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.login h1 {
  color: var(--primary);
  text-align: center;
  margin-bottom: 4px;
}
.login h1 b {
  color: var(--accent);
}
.login .sub {
  text-align: center;
  color: var(--muted);
  margin-bottom: 18px;
}
.login .langs {
  justify-content: center;
  margin-bottom: 14px;
}
.login .langs button {
  color: var(--primary);
  border-color: var(--primary);
}
.login .langs button.active {
  background: var(--primary);
  color: #fff;
}
.login .btn {
  width: 100%;
  justify-content: center;
  padding: 10px;
}

@media (max-width: 800px) {
  .hdr .burger {
    display: block;
  }
  .side {
    transform: translateX(-100%);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  }
  body.nav-open .side {
    transform: none;
  }
  .main {
    margin-left: 0;
    padding: 12px;
  }
  .hdr .brand {
    font-size: 16px;
  }
  .frow {
    grid-template-columns: 1fr;
  }
  .hdr .uname small {
    display: none;
  }
}

.login .sso-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin: 18px 0 14px;
  font-size: 13px;
}
.login .sso-divider:before,
.login .sso-divider:after {
  content: '';
  flex: 1;
  border-top: 1px solid #d0d5dd;
}
.login .sso-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 10px;
}
.login .btn.sso-apple {
  background: #000;
  color: #fff;
  border-color: #000;
  gap: 8px;
  align-items: center;
}
.login .btn.sso-apple:disabled {
  opacity: 0.6;
}
.login .sso-google .btn {
  background: #fff;
  color: #333;
  border: 1px solid #d0d5dd;
}

/* ---- avatars, call links, company, version */
.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #0d47a1;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  vertical-align: middle;
}
.av.ADMIN {
  background: #e65100;
}
.av.EXTERNAL_USER {
  background: #757575;
}
.av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e8f5e9;
  color: #2e7d32;
  text-decoration: none;
  font-size: 16px;
  vertical-align: middle;
}
.call:hover {
  background: #c8e6c9;
}
.nowrap {
  white-space: nowrap;
}
.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.clogo {
  max-height: 70px;
  max-width: 220px;
  object-fit: contain;
  background: #f5f7fa;
  border-radius: 8px;
  padding: 6px;
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
}
.login-logo img {
  max-height: 70px;
  max-width: 220px;
  object-fit: contain;
}
.linkbtn {
  background: none;
  border: 0;
  color: #0d47a1;
  cursor: pointer;
  font-weight: 600;
  margin-top: 8px;
  padding: 6px 0;
}
.nav-version {
  margin-top: auto;
  padding: 10px 14px;
  font-size: 12px;
  opacity: 0.75;
}
.alert.ok {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #a5d6a7;
}
code.temp {
  font-size: 18px;
  padding: 2px 8px;
  background: #fff;
  border: 1px dashed #0d47a1;
  border-radius: 6px;
  user-select: all;
}
.center {
  text-align: center;
}

/* users table: e-mail may wrap; the company column is hidden on narrower screens (still in the edit form) */
.tbl td.break {
  word-break: break-all;
  min-width: 140px;
}
@media (max-width: 1400px) {
  .tbl .col-company {
    display: none;
  }
}

/* ROINSTAL wordmark in the header and on the login card */
.hdr .brand img {
  height: 18px;
  width: auto;
  vertical-align: -2px;
}
.login h1.brand-title img {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 6px;
}
.login h1.brand-title b {
  display: block;
  font-size: 18px;
  letter-spacing: 9px;
  padding-left: 9px;
}

/* product caption ("TERENSKO DELO" …) */
.hdr .brand b {
  font-size: 12px;
  letter-spacing: 2px;
  margin-left: 4px;
}
.login h1.brand-title b {
  font-size: 15px;
  letter-spacing: 5px;
  padding-left: 5px;
}

/* picture avatars (e.g. the white ROINSTAL logo of the admin) get a thin outline */
.av:has(img) {
  background: #fff;
  box-shadow: 0 0 0 1px #d5dbe3;
}
