/* Admin screens: settings panels, upload, week lists, users table, audit feed. */

/* ---------- settings grid ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel-upload { grid-column: 1 / -1; }

/* ---------- dropzone / uploads ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 34px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag, .dropzone:focus-visible {
  border-color: var(--primary); background: rgba(210, 31, 31, .04); outline: none;
}
.dropzone .big { font-size: 40px; }
.upload-actions { margin-top: 12px; }

.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13.5px;
}
.fr-status { width: 18px; flex: none; display: inline-flex; justify-content: center; }
.fr-name {
  font-weight: 600; max-width: 42%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fr-size { flex: none; }
.fr-msg { flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-msg.err { color: var(--primary); }
.fr-x {
  flex: none; border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 0 4px;
}
.fr-x:hover { color: var(--primary); }

/* ---------- week lists ---------- */
.week-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 440px; overflow-y: auto; overscroll-behavior: contain;
}
.week-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.wi-dot {
  flex: none; width: 10px; height: 10px; margin-top: 5px;
  border-radius: 50%; background: var(--chip, var(--grey));
}
.wi-dot.green { --chip: var(--green); }
.wi-dot.purple { --chip: var(--purple); }
.wi-dot.yellow { --chip: var(--yellow); }
.wi-dot.neutral { --chip: var(--grey); }
.wi-main { flex: 1; min-width: 0; }
.wi-title { font-weight: 700; font-size: 14px; }
.wi-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wi-actions { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; align-self: center; }
.wi-open .ico { color: var(--primary); }

/* ---------- users ---------- */
.users-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.users-left { display: flex; flex-direction: column; gap: 18px; }
.users-left .card + .card { margin-top: 0; }

.create-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.create-form .input { flex: 1; min-width: 140px; }
.create-form .select { min-width: 150px; }
.create-note { margin-top: 10px; }
.create-actions { margin-top: 10px; }

.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; }
table.data th, table.data td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
table.data th {
  color: var(--muted); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em;
}
table.data tr:hover td { background: var(--surface-2); }
.notes-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ua-cell { text-align: right; white-space: nowrap; }
.ua-cell .btn { margin-left: 4px; }

/* ---------- audit feed ---------- */
.audit-list {
  display: flex; flex-direction: column;
  max-height: 60vh; overflow-y: auto; overscroll-behavior: contain;
}
.audit-item { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: none; }
.audit-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; }
.audit-body { min-width: 0; }
.audit-msg { font-size: 13.5px; line-height: 1.35; }
.audit-time { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- personal settings modal ---------- */
.settings-block { margin-top: 18px; }
.settings-note { font-size: 12.5px; margin: 16px 0 0; }

/* toggle switch */
.switch-row {
  display: flex; align-items: center; gap: 14px;
  min-height: var(--tap); padding: 8px 0;
  cursor: pointer; user-select: none;
  border-top: 1px solid var(--border);
}
.sw-text { flex: 1; min-width: 0; }
.sw-label { display: block; font-size: 14.5px; font-weight: 600; }
.sw-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.sw-input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-track {
  flex: none; position: relative; width: 46px; height: 28px;
  border-radius: var(--radius-pill);
  background: var(--border);
  transition: background .2s ease;
}
.sw-thumb {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.sw-input:checked + .sw-track { background: var(--ok); }
.sw-input:checked + .sw-track .sw-thumb { transform: translateX(18px); }
.sw-input:focus-visible + .sw-track { box-shadow: 0 0 0 3px rgba(210, 31, 31, .25); }
.switch-row:active .sw-thumb { width: 26px; }

.fav-add { display: flex; gap: 8px; }
.fav-add .input { flex: 1; }
.fav-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 22px; }
.fav-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 3px 6px 3px 11px;
  font-size: 13px; font-weight: 700;
}
.fav-tag button {
  display: inline-flex; border: none; background: transparent; color: var(--muted);
  cursor: pointer; padding: 2px;
}
.fav-tag button:hover { color: var(--primary); }
.fav-empty { font-size: 13px; }

/* ---------- responsive data list (table on wide screens, cards on phones) ---------- */
.data-list { display: flex; flex-direction: column; }
.dl-head, .dl-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) 92px minmax(120px, 1.6fr) 96px auto;
  gap: 12px; align-items: center; padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.dl-head {
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2);
}
.dl-row:last-child { border-bottom: none; }
.dl-row:hover { background: var(--surface-2); }
.dl-row.is-self { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.dl-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dl-avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; font-weight: 800; color: var(--muted);
}
.dl-row.is-self .dl-avatar { background: var(--primary); border-color: var(--primary); color: #fff; }
.dl-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-you { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.dl-note, .dl-date { font-size: 13.5px; color: var(--muted); min-width: 0; }
.dl-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.dl-actions .btn .ico { margin-right: -2px; }
.dl-msg { padding: 14px; }

/* extra line in week items */
.wi-stats { font-size: 12.5px; color: var(--text); font-weight: 600; }

/* ---------- settings: groups, choice rows, colours ---------- */
.settings-group {
  margin-top: 18px; padding-top: 4px;
  border-top: 2px solid var(--border);
}
.settings-group-title {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin: 10px 0 6px;
}

.choice-row { padding: 8px 0; border-top: 1px solid var(--border); }
.choice-row .sw-text { margin-bottom: 8px; }
.segmented-sm button { min-height: 34px; font-size: 13px; }

.color-pair { display: flex; gap: 8px; margin: 4px 0 2px; }
.color-row {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer;
}
.color-row .sw-label { font-size: 12.5px; font-weight: 600; min-width: 0; }
.color-swatch {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, .15);
}
.color-input {
  position: absolute; opacity: 0; width: 0; height: 0; border: none; padding: 0;
}

/* ---------- storage consent ---------- */
.consent {
  position: fixed; z-index: 90;
  left: max(16px, var(--safe-left)); right: max(16px, var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  max-width: 520px; margin: 0 auto; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
  opacity: 0; transform: translateY(14px);
  transition: opacity .22s ease, transform .22s ease;
}
.consent.show { opacity: 1; transform: none; }
.consent-title { font-weight: 800; margin-bottom: 4px; }
.consent-text { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
