:root {
  --brand-red: #e30613;
  --brand-blue: #006eb6;
  --brand-blue-dark: #00508f;
  --brand-red-soft: #ffe5e8;
  --brand-blue-soft: #e3f2fb;
  --bg: #f5f8fb;
  --panel: #ffffff;
  --panel-soft: #edf5fb;
  --border: #b7c9d8;
  --border-strong: #006eb6;
  --text: #172434;
  --muted: #627386;
  --blue: var(--brand-blue);
  --blue-soft: var(--brand-blue-soft);
  --amber: #c47a05;
  --amber-soft: #fff1d6;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: var(--brand-red);
  --red-soft: var(--brand-red-soft);
  --focus: var(--brand-blue);
  --workspace-min-width: 1360px;
  --workspace-max-width: 1760px;
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: auto;
  color: var(--text);
  background: var(--bg);
}

body.modal-open {
  overflow: hidden;
}

body.is-dnd-active {
  user-select: none;
}

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

button {
  min-height: 36px;
  border: 2px solid var(--brand-blue-dark);
  border-radius: 6px;
  color: #ffffff;
  background: var(--blue);
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: var(--brand-blue-dark);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.button-secondary,
.filter-button {
  color: var(--text);
  border-color: var(--border);
  background: #ffffff;
}

.button-secondary:hover,
.filter-button:hover {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  padding: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(16, 24, 40, 0.14);
}

.login-panel h1 {
  margin-bottom: 4px;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  min-width: var(--workspace-min-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 6px 12px;
  border-bottom: 3px solid var(--brand-blue);
  background:
    linear-gradient(90deg, rgba(0, 110, 182, 0.08), rgba(227, 6, 19, 0.04) 38%, rgba(255, 255, 255, 0.96) 72%),
    rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
}

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

.company-logo {
  display: block;
  width: 128px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 1px 7px;
  border: 2px solid rgba(0, 110, 182, 0.35);
  border-radius: 999px;
  color: var(--brand-blue-dark);
  background: #ffffff;
  font-size: 12px;
}

.sync-state.is-error {
  color: var(--red);
  border-color: rgba(227, 6, 19, 0.45);
  background: var(--red-soft);
}

.header-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.account-label {
  max-width: 170px;
  min-width: 0;
  padding: 5px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  color: var(--brand-blue-dark);
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.path-form {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.folder-picker-form {
  grid-template-columns: auto minmax(260px, 1fr) 82px 82px auto minmax(230px, 340px) 92px 90px;
  width: 100%;
}

.folder-picker-form select {
  min-width: 0;
}

#rootFolderPath,
#requestFolderSelect {
  min-width: 0;
}

#requestFolderSelect {
  max-width: 340px;
  justify-self: stretch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-picker-form > span:empty {
  min-height: 1px;
}

.path-label {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar button,
.topbar input,
.topbar select {
  min-height: 30px;
}

.topbar button {
  padding: 0 9px;
}

.topbar input,
.topbar select {
  padding: 0 8px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 2px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
}

input,
select {
  padding: 0 10px;
}

textarea {
  min-height: 74px;
  resize: vertical;
  padding: 9px 10px;
  line-height: 1.35;
}

main {
  width: min(100%, var(--workspace-max-width));
  min-width: var(--workspace-min-width);
  margin: 0 auto;
  padding: 18px 20px 28px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-left: 5px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.metric.status-in_work,
.column.status-in_work {
  border-left-color: var(--blue);
}

.metric.status-in_production,
.column.status-in_production {
  border-left-color: var(--amber);
}

.metric.status-done,
.column.status-done {
  border-left-color: var(--green);
}

.metric.status-paused,
.column.status-paused {
  border-left-color: var(--red);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-button {
  min-width: 88px;
  padding: 0 12px;
}

.filter-button.is-active {
  color: #ffffff;
  border-color: var(--brand-red);
  background: var(--brand-red);
}

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 2px solid #d92d20;
  border-radius: 8px;
  color: var(--red);
  background: var(--red-soft);
}

.notice.is-info {
  color: var(--brand-blue-dark);
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.notice.is-hidden {
  display: none;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(245, 248, 251, 0.42);
}

.loading-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 16px;
  border: 2px solid var(--brand-blue);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.16);
  font-weight: 700;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--brand-blue-soft);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  min-width: 0;
  min-height: 180px;
  padding: 10px;
  border: 2px solid var(--border-strong);
  border-left: 6px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.column.is-drop-target {
  border-color: var(--blue);
  background: var(--brand-blue-soft);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.28);
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 0 10px;
}

.column-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: 999px;
  color: var(--brand-blue-dark);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.column-search {
  height: 36px;
  margin-bottom: 10px;
  border-color: var(--border-strong);
  background: #ffffff;
}

.column-search::-webkit-search-cancel-button {
  cursor: pointer;
}

.cards {
  display: grid;
  grid-auto-rows: max-content;
  gap: 10px;
  padding-left: 0;
}

.task-card {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  text-align: left;
  white-space: normal;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.task-card.is-folder {
  border: 2px solid #596879;
  box-shadow:
    inset 0 0 0 1px #d7dee6,
    0 1px 3px rgba(16, 24, 40, 0.08);
}

.task-card:hover {
  color: var(--text);
  background: #f8fafc;
}

.task-card:active {
  cursor: grabbing;
}

.task-card.is-dragging {
  opacity: 0.55;
  border-style: dashed;
  pointer-events: none;
}

.task-card.is-saving {
  border-color: var(--brand-red);
}

.card-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: start;
}

.task-title {
  display: block;
  margin: 0;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 2px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 600;
}

.remove-file-button {
  min-height: 26px;
  padding: 0 8px;
  border-color: #f1a7a1;
  color: var(--red);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.remove-file-button:hover {
  background: var(--red-soft);
}

.task-path {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#taskModal .task-path {
  font-size: 13px;
  line-height: 1.45;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(96px, 0.75fr) minmax(132px, 1fr);
  gap: 8px;
}

#taskModal .field-grid {
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

#taskModal .field {
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#taskModal .field label {
  font-size: 14px;
}

.comments {
  display: grid;
  gap: 8px;
}

#taskModal .comments {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

#taskModal .comments .field {
  gap: 6px;
}

#taskModal .comments textarea {
  min-height: 160px;
}

.quantity-field {
  align-content: start;
}

#taskModal .quantity-field {
  padding: 12px;
  border: 2px solid #000000;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
}

.quantity-total {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quantity-list {
  display: flex;
  flex-direction: column;
  align-content: start;
  gap: 6px;
  height: 176px;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable both-edges;
  padding: 6px;
}

.quantity-row {
  display: flex;
  align-items: flex-start;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 42px;
  padding: 6px;
  border: 2px solid #000000;
  border-radius: 6px;
  background: #ffffff;
  box-sizing: border-box;
}

.quantity-row input {
  min-height: 0;
  padding: 0 10px;
  font-size: 14px;
  box-sizing: border-box;
}

.quantity-label-input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.quantity-value-input {
  text-align: center;
  flex: 0 0 104px;
  width: 104px;
  height: 42px;
  min-height: 42px;
}

.quantity-remove-button,
.quantity-add-button {
  min-height: 0;
  padding: 0 10px;
  font-size: 14px;
}

.quantity-remove-button {
  width: 34px;
  height: 100%;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.quantity-add-button {
  justify-self: start;
  min-height: 36px;
}

.quantity-add-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.status-pill.status-in_work {
  color: #174fbf;
  background: var(--blue-soft);
}

.status-pill.status-in_production {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.status-done {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.status-paused {
  color: var(--red);
  background: var(--red-soft);
}

.empty {
  min-height: 92px;
  padding: 16px;
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(24, 33, 43, 0.46);
}

.modal-backdrop:hover {
  background: rgba(24, 33, 43, 0.5);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  margin: auto 0;
  overflow: auto;
  padding: 18px;
  border: 2px solid #596879;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.22);
}

#taskModal .modal-panel {
  width: 1220px;
  max-width: none;
  max-height: calc(100vh - 16px);
  padding: 30px 32px;
  gap: 22px;
  font-size: 15px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#taskModal .modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px) auto;
  align-items: start;
  gap: 16px;
}

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

.modal-status-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

#taskModal .modal-status-field {
  justify-self: stretch;
}

#taskModal .modal-status-field label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

#taskModal .modal-status-field select {
  width: 100%;
}

.modal-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.25;
}

#taskModal .modal-heading h2 {
  font-size: 26px;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-color: var(--border-strong);
  color: var(--text);
  background: #ffffff;
  font-size: 22px;
  line-height: 1;
}

#taskModal .modal-close {
  width: 40px;
  height: 40px;
  min-height: 40px;
  font-size: 24px;
}

.modal-close:hover {
  background: var(--panel-soft);
}

.modal-fields {
  display: grid;
  gap: 12px;
}

#taskModal .modal-fields {
  gap: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

#taskModal .modal-footer {
  min-height: 48px;
}

#taskModal .modal-actions button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#taskModal textarea {
  min-height: 200px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.45;
}

#taskModal input,
#taskModal select {
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
}

#taskModal .quantity-row input {
  min-height: 0;
  padding: 0 10px;
  font-size: 14px;
  box-sizing: border-box;
}

#taskModal .quantity-row .quantity-label-input,
#taskModal .quantity-row .quantity-value-input {
  width: auto;
}

#taskModal .quantity-row .quantity-label-input {
  flex: 1 1 0;
  width: 0;
  min-height: 42px;
  padding: 8px 10px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

#taskModal .quantity-row .quantity-value-input {
  appearance: textfield;
  -moz-appearance: textfield;
  flex: 0 0 104px;
  height: 42px;
  min-height: 42px;
}

#taskModal .quantity-row .quantity-value-input::-webkit-outer-spin-button,
#taskModal .quantity-row .quantity-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#taskModal .quantity-row .quantity-remove-button {
  min-height: 0;
  height: 42px;
  width: 34px;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

#taskModal .quantity-add-button {
  min-height: 36px;
}

textarea:disabled,
input:disabled,
select:disabled {
  color: var(--muted);
  background: #f1f4f7;
  cursor: not-allowed;
}

.assignment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding: 6px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.assignment-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 4px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.assignment-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: 0 0 auto;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.admin-panel {
  width: 1260px;
  max-width: none;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-tab {
  min-height: 40px;
  border-color: var(--border);
  color: var(--text);
  background: #ffffff;
  font-weight: 700;
}

.admin-tab:hover {
  background: var(--panel-soft);
}

.admin-tab.is-active {
  color: #ffffff;
  border-color: #2f3a45;
  background: #2f3a45;
}

.admin-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 2px solid var(--border);
}

.admin-section h3 {
  margin: 0;
  font-size: 16px;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-row,
.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-form {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.admin-row > input[type="text"] {
  grid-column: 1 / -1;
}

.admin-row > button {
  justify-self: end;
  min-width: 120px;
}

.user-row {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.user-row > input[type="text"] {
  grid-column: auto;
}

.user-row > button {
  grid-column: 2;
}

.admin-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-check input[type="checkbox"] {
  justify-self: end;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
}

.admin-username {
  grid-column: 1 / -1;
  padding: 7px 10px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.admin-users-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 8px;
  align-items: center;
}

.roles-table-wrap,
.accounts-table-wrap {
  overflow: auto;
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
}

.roles-table,
.accounts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.roles-table {
  min-width: 1280px;
}

.accounts-table {
  min-width: 940px;
}

.roles-table th,
.roles-table td,
.accounts-table th,
.accounts-table td {
  padding: 8px;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.roles-table th,
.accounts-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #ffffff;
  background: var(--brand-blue-dark);
  text-align: left;
  font-size: 12px;
}

.roles-table input,
.roles-table select,
.accounts-table input,
.accounts-table select {
  width: 100%;
  min-height: 34px;
  font-size: 13px;
}

.account-field-with-action,
.account-notes-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.copy-button,
.account-save-button {
  min-height: 34px;
  padding: 6px 9px;
  white-space: nowrap;
}

.copy-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.account-login-cell,
.account-password-cell {
  min-width: 190px;
}

.account-notes-cell {
  min-width: 240px;
}

.accounts-empty {
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.role-name-cell {
  min-width: 220px;
}

.role-flag-cell {
  min-width: 150px;
}

.role-flag-cell .admin-check {
  width: 100%;
}

.role-action-cell {
  width: 1%;
  white-space: nowrap;
}

.role-action-cell .role-save-button {
  min-width: 116px;
}

.account-add-form {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 0.9fr) minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
}

.account-add-form button {
  min-width: 150px;
}

@media (max-width: 1180px) {
  .board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  #taskModal .comments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    position: sticky;
    grid-template-columns: 290px minmax(0, 1fr);
    align-items: center;
  }

  .brand {
    justify-content: flex-start;
  }

  .path-form {
    grid-template-columns: auto minmax(220px, 1fr) auto auto;
  }

  .folder-picker-form {
    grid-template-columns: auto minmax(260px, 1fr) 82px 82px auto minmax(230px, 340px) 92px 90px;
  }

  .folder-picker-form > span:empty {
    display: block;
  }

  .account-bar {
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .account-label {
    flex: 0 1 auto;
  }

  .admin-users-toolbar,
  .account-add-form {
    grid-template-columns: 1fr;
  }

  .accounts-table {
    min-width: 980px;
  }

  .path-label {
    font-size: 12px;
  }

  main {
    padding: 18px 20px 28px;
  }

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

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

  .admin-row,
  .admin-form,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-row > button {
    grid-column: auto;
  }
}

@media (max-width: 460px) {
  #taskModal .modal-header {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 420px) auto;
  }

  #taskModal .modal-status-field {
    grid-column: auto;
  }

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

  .field-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: flex;
    grid-template-columns: none;
  }

  .modal-panel {
    padding: 18px;
  }

  .modal-heading {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  .modal-footer {
    align-items: center;
    flex-direction: row;
  }

  .modal-actions {
    justify-content: flex-end;
  }

  .modal-actions button {
    width: auto;
  }

  .filter-button {
    min-width: 88px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .accounts-table-wrap {
    overflow: visible;
    border-color: #333333;
  }

  .accounts-table {
    min-width: 0;
    font-size: 11px;
  }

  .accounts-table th {
    color: #000000;
    background: #ffffff;
  }

  .copy-button,
  .account-save-button,
  .admin-users-toolbar,
  .account-add-form {
    display: none;
  }
}
