/* Shares its palette and type with the ekreative Redmine and Inbucket themes
   (redmine-iac themes/ekreative), so the three tools read as one family. */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-latin-ext-ga7Qi-c.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-latin-vOuBqtB.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --ink: #161616;
  --ink-2: #1c1c1c;
  --line-dark: #2f2f2f;
  --lime: #b2ec46;
  --lime-dark: #7fb913;
  --lime-deep: #2f6f0a;
  --lime-deeper: #1f4a06;
  --lime-10: rgba(178, 236, 70, .10);
  --lime-16: rgba(178, 236, 70, .16);
  --lime-br: rgba(178, 236, 70, .44);
  --coral-deep: #c02b2b;
  --gray-0: #faf9f7;
  --gray-1: #f4f2ee;
  --gray-2: #edeae4;
  --gray-3: #e6e3dd;
  --gray-4: #d8d4cc;
  --gray-6: #8a867e;
  --gray-7: #56534d;
  --text: #2f2d29;
  --r-pill: 22px;
  --r-card: 8px;
  --focus-ring: 0 0 0 3px rgba(178, 236, 70, .30);
  /* Hanken Grotesk has no Cyrillic, so Ukrainian text falls through to the next face. */
  --font: "Hanken Grotesk", "Noto Sans", -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--gray-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--lime-deep); }
a:hover { color: var(--lime-deeper); }

h1, h2, h3, h4 { color: var(--ink); letter-spacing: -.025em; line-height: 1.2; }
h2 { font-size: 21px; margin: 32px 0 12px; }
h3 { font-size: 17px; margin: 24px 0 10px; }
h4 { font-size: 15px; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--gray-3); margin: 24px 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
svg { flex: none; }

:focus-visible { outline: 2px solid var(--lime-dark); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.muted { color: var(--gray-7); }
.small { font-size: 13px; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack > * + * { margin-top: 16px; }

/***** Header *****/
.site-header { background: var(--ink); border-bottom: 1px solid var(--line-dark); }
.site-header__inner {
  max-width: 1170px;
  margin: 0 auto;
  padding: 10px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 98px; height: 21px; display: block; }
.brand__tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--lime);
  border-radius: var(--r-pill);
  padding: 3px 9px;
}
.site-header__inner > nav { margin-left: auto; }
.site-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .66);
  text-decoration: none;
  border-radius: var(--r-pill);
  padding: 6px 10px;
}
.site-nav a:hover { color: var(--lime); background: var(--lime-10); }
.site-nav a[aria-current] { color: var(--lime); background: var(--lime-10); box-shadow: inset 0 0 0 1px var(--lime-br); }

/***** Page *****/
.page { max-width: 1170px; margin: 0 auto; padding: 28px 22px 64px; }
.page-back { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.page-title {
  margin: 0 0 24px;
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.toolbar > :only-child { margin-left: auto; }
.card {
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-card);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.card--narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/***** Buttons *****/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--lime); color: var(--ink); }
.btn-primary:hover { background: var(--lime-dark); color: var(--ink); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--gray-4); }
.btn-secondary:hover { border-color: var(--lime-dark); color: var(--lime-deep); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { color: var(--lime); }
.btn-danger { background: var(--coral-deep); color: #fff; }
.btn-danger:hover { background: #a12323; color: #fff; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-card);
  background: transparent;
  color: var(--gray-7);
  text-decoration: none;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--lime-16); color: var(--lime-deep); border-color: var(--lime-br); }
.icon-btn--danger:hover { background: #fde8e8; color: var(--coral-deep); border-color: #f3c4c4; }

/***** Tables *****/
.table-wrap {
  position: relative;
  background: #fff;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-card);
  overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-3);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-7);
  white-space: nowrap;
}
.table td { padding: 10px 16px; border-top: 1px solid var(--gray-2); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: var(--lime-10); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .primary { font-weight: 600; color: var(--ink); }
.table .primary a { color: inherit; text-decoration: none; }
.table .primary a:hover { color: var(--lime-deep); text-decoration: underline; }
.table .actions-col { text-align: right; width: 1%; }
.table--form { min-width: 640px; }
.table--compact th { padding: 10px 12px; }
.table--compact td { padding: 6px 12px; }
.table-empty { padding: 32px 16px; text-align: center; color: var(--gray-7); }
.table th a { color: var(--gray-7); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover, .table th.sorted a { color: var(--lime-deep); }
.table th a svg { width: 13px; height: 13px; }
.actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.actions form { display: contents; }

/***** Badges *****/
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: var(--r-pill);
  padding: 2px 10px;
  background: var(--gray-2);
  color: var(--text);
  text-decoration: none;
}
.badge--success { background: rgba(178, 236, 70, .22); color: var(--lime-deeper); }
.badge--warning { background: #fbf6d9; color: #5c4d00; }
.badge--info { background: #e4ecff; color: #1d2f8c; }
.badge--danger { background: #fde8e8; color: var(--coral-deep); }
.badge--outline { background: transparent; color: var(--gray-7); box-shadow: inset 0 0 0 1px var(--gray-4); }
a.badge:hover { filter: brightness(.95); }

/***** Alerts and flashes *****/
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-card);
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.alert > svg { width: 18px; height: 18px; margin-top: 2px; }
.alert__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert__close { margin: -6px -6px -6px 0; width: 30px; height: 30px; color: inherit; }
.alert--success { background: var(--lime-16); border-color: var(--lime-br); color: var(--lime-deeper); }
.alert--danger { background: #fde8e8; border-color: #f3c4c4; color: var(--coral-deep); }
.alert--warning { background: #fbf6d9; border-color: #efe3a1; color: #5c4d00; }
.alert--info { background: #eef2ff; border-color: #cfd8f7; color: #1d2f8c; }

/***** Forms *****/
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 0 28px;
}
.form-grid > .span-all { grid-column: 1 / -1; }
.form-section + .form-section { border-top: 1px solid var(--gray-2); margin-top: 8px; padding-top: 24px; }
.form-section > h3:first-child, .form-section > h4:first-child { margin-top: 0; }
.form-row { margin-bottom: 18px; min-width: 0; }
.form-label, .form-row legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-7);
}
.form-label.required::after, .form-row legend.required::after { content: " *"; color: var(--coral-deep); }
.form-control {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--gray-4);
  border-radius: var(--r-card);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
}
textarea.form-control { min-height: 96px; resize: vertical; }
select.form-control[multiple] { min-height: 120px; }
.form-control:focus { outline: none; border-color: var(--lime-dark); box-shadow: var(--focus-ring); }
.form-control:disabled, .form-control[readonly] { background: var(--gray-1); color: var(--gray-7); }
.form-control::placeholder { color: var(--gray-6); }
.form-row--error .form-control { border-color: var(--coral-deep); }
.form-help { margin-top: 6px; font-size: 13px; color: var(--gray-7); }
.form-errors { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; font-weight: 600; color: var(--coral-deep); }
.form-errors--form { margin: 0 0 16px; }
.form-inline-group { display: flex; flex-wrap: wrap; gap: 8px; }
.form-inline-group > .form-control { flex: 1 1 90px; width: auto; }
.form-row fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.form-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--lime-deep); }
.form-check label { font-weight: 600; color: var(--text); }
.form-choices { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.table-wrap + .form-actions { margin-top: 16px; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* A checkbox drawn as an on/off switch, replacing bootstrap-toggle. */
.form-switch.cluster { gap: 0 32px; }
.form-switch input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--gray-4);
  cursor: pointer;
  transition: background-color .15s;
}
.form-switch input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .15s;
}
.form-switch input[type="checkbox"]:checked { background: var(--lime-deep); }
.form-switch input[type="checkbox"]:checked::before { transform: translateX(20px); }
.form-switch input[type="checkbox"]:focus-visible { box-shadow: var(--focus-ring); outline: none; }

input[type="file"].form-control { padding: 6px; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.photo-preview { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 50%; margin-bottom: 12px; }

/* Collection items (contracts on the performer form). */
.collection > h3 { margin-top: 0; }
.collection-item {
  position: relative;
  border: 1px solid var(--gray-3);
  border-radius: var(--r-card);
  background: var(--gray-0);
  padding: 16px 52px 0 16px;
  margin-bottom: 12px;
}
.collection-item__remove { position: absolute; top: 8px; right: 8px; }
.collection-add { display: flex; justify-content: flex-end; margin-bottom: 18px; }

/* Signature pad. */
.signature-pad { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 100%; }
.signature-pad canvas {
  display: block;
  width: 500px;
  max-width: 100%;
  height: 200px;
  background: #fff;
  border: 1px solid var(--gray-4);
  border-radius: var(--r-card);
  touch-action: none;
}

/* TomSelect, which renders the autocomplete fields. */
.ts-wrapper.form-control { padding: 0; border: 0; background: transparent; min-height: 0; box-shadow: none; }
.ts-wrapper .ts-control {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--gray-4);
  border-radius: var(--r-card);
  font: inherit;
  font-size: 14px;
  box-shadow: none;
}
.ts-wrapper.single .ts-control { background: #fff; }
.ts-wrapper.focus .ts-control { border-color: var(--lime-dark); box-shadow: var(--focus-ring); }
.ts-wrapper.disabled .ts-control { background: var(--gray-1); opacity: 1; }
.ts-wrapper.multi .ts-control > div {
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--gray-2);
  color: var(--text);
}
.ts-wrapper.multi .ts-control > div.active { background: var(--lime); color: var(--ink); }
.ts-dropdown { border-color: var(--gray-4); border-radius: var(--r-card); font-size: 14px; overflow: hidden; }
.ts-dropdown .active { background: var(--lime-16); color: var(--ink); }

/***** Tabs *****/
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--gray-3); }
.tab {
  display: block;
  padding: 10px 16px;
  border-radius: var(--r-card) var(--r-card) 0 0;
  color: var(--gray-7);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.tab:hover { color: var(--ink); background: var(--gray-1); }
.tab[aria-selected="true"] {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 3px 0 var(--lime), inset 1px 0 0 var(--gray-3), inset -1px 0 0 var(--gray-3);
}
.tab--invalid, .tab--invalid:hover, .tab--invalid[aria-selected="true"] { color: var(--coral-deep); }
.tab-panel {
  background: #fff;
  border: 1px solid var(--gray-3);
  border-top: 0;
  border-radius: 0 0 var(--r-card) var(--r-card);
  padding: 28px;
}
.tab-panel[hidden] { display: none; }

/***** Dialog *****/
.dialog {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border: 0;
  border-radius: var(--r-card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
  color: var(--text);
}
.dialog::backdrop { background: rgba(22, 22, 22, .55); }
.dialog h2 { margin: 0 0 20px; font-size: 19px; }

/***** Filters and pagination *****/
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter .form-control { width: 260px; max-width: 100%; border-radius: var(--r-pill); padding-left: 14px; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 24px 0 0; padding: 0; list-style: none; }
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.pagination a:hover { background: var(--gray-2); }
.pagination [aria-current] { background: var(--ink); color: var(--lime); }
.pagination .disabled { color: var(--gray-4); }
.pagination svg { width: 16px; height: 16px; }

/***** Documents shown in the app (acts, invoices, agreements) *****/
.document { background: #fff; border: 1px solid var(--gray-3); border-radius: var(--r-card); padding: 40px; overflow-x: auto; }

/* The Redmine task table, edited in place (table_editor_controller.js). */
.table-editor { display: grid; gap: 12px; }
.table-editor .document { padding: 24px; }
.table-editor [contenteditable] { cursor: text; border-radius: 2px; }
.table-editor [contenteditable]:hover { background: var(--lime-10); }
.table-editor [contenteditable]:focus { outline: 2px solid var(--lime-dark); outline-offset: -2px; background: #fff; }

/***** Loading state for long-running submits *****/
.loading { display: inline-flex; align-items: center; gap: 10px; color: var(--gray-7); font-weight: 600; }
.loading[hidden] { display: none; }
.loading svg { width: 18px; height: 18px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/***** Sign-in pages *****/
.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  background: var(--ink);
}
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth__brand img { width: 140px; height: 30px; }
.auth__brand--classic img { width: 96px; height: 96px; object-fit: contain; }
.auth__brand--splat img { animation: splat .4s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes splat { from { transform: scale(.2) rotate(-20deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .auth__brand--splat img { animation: none; } }
.auth__brand p {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--lime);
}
.auth__card { width: 100%; max-width: 400px; background: var(--gray-0); border-radius: var(--r-card); padding: 32px; }
.auth__card h1 { margin: 0 0 18px; font-size: 24px; }
.auth__card .btn { width: 100%; min-height: 44px; font-size: 15px; }
.auth__note { margin: 14px 0 0; font-size: 13px; color: var(--gray-7); text-align: center; }

@media (max-width: 640px) {
  .page { padding: 20px 16px 48px; }
  .page-title { font-size: 26px; }
  .card, .tab-panel { padding: 18px; }
  .document { padding: 20px; }
  .site-header__inner > nav { margin-left: 0; }
}

@media print {
  .site-header, .page-back, .toolbar, .actions, .pagination, .alert { display: none; }
  body { background: #fff; }
  .page { padding: 0; }
  .page--document .page-title { display: none; }
  .document { border: 0; padding: 0; }
}
