/* Organización (org_settings_screen.dart). Prefix ors- (unique across the
   screens: every screen's CSS loads on every page). Numbers are Flutter's
   logical px; the theme's buttons (24×12 padding, radius 8), dialog
   (radius 12 with a border) and text sizes come from app_theme.dart. */

/* Flutter pads the screen 32px; .page already gives 42 on the left (its
   14px inset + the gutter) and 28 on the right. */
.ors { display: flex; flex-direction: column; gap: 24px; padding: 16px 4px 48px 0; margin-left: -10px; container: ors / inline-size; }

/* The fallback heading (_Header): only where Flutter has no top bar for the
   title, which is a phone. */
.ors-heading { display: none; align-items: center; gap: 16px; margin-bottom: 8px; }
.ors-heading-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ors-heading-text b { font-size: 24px; font-weight: 700; line-height: 1.2; overflow-wrap: break-word; }
.ors-heading-text small { font-size: 13px; color: var(--text-2); }

.ors-logo { width: 40px; height: 40px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 18px; font-weight: 700; color: var(--text); }
.ors-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ors-logo-lg { width: 56px; height: 56px; border-radius: 12px; font-size: 24px; }

/* _Card */
.ors-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.ors-card-head { display: flex; align-items: center; gap: 8px; min-height: 69px; padding: 20px 20px 16px 24px; border-bottom: 1px solid var(--border); }
/* w600 drawn as Flutter draws it (htmx-ui.md: "Flutter's w600 is lighter") */
.ors-card-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 400; -webkit-text-stroke: .4px currentColor; line-height: 1.43; letter-spacing: .15px; }
.ors-card-body { padding: 16px 24px 20px; }
.ors-empty { padding: 24px; color: var(--text-2); }

/* Buttons: ElevatedButton, OutlinedButton, TextButton as the theme draws
   them, at the desktop's compact density (32px tall, 2px less padding). */
.ors-ebtn, .ors-obtn, .ors-pbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 22px; border-radius: 8px; font-size: 14px; font-weight: 500; letter-spacing: .1px; white-space: nowrap; flex: none; transition: background-color 100ms linear; }
.ors-ebtn, .ors-pbtn { background: var(--primary); color: #fff; }
.ors-ebtn:hover, .ors-pbtn:hover { background: color-mix(in srgb, var(--primary) 92%, #000); }
.ors-obtn { border: 1px solid var(--border); color: var(--text); }
.ors-obtn:hover { background: var(--hover); }
.ors-tbtn { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 20px; color: var(--primary); font-size: 14px; font-weight: 500; letter-spacing: .1px; }
.ors-tbtn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.ors-danger { background: var(--error); }
.ors-danger:hover { background: color-mix(in srgb, var(--error) 90%, #000); }
.ors-ebtn:disabled, .ors-pbtn:disabled, .ors-tbtn:disabled { opacity: .45; pointer-events: none; }
.ors-edit-actions { display: inline-flex; align-items: center; gap: 8px; }
.ors-edit-actions .ors-ebtn, .ors-pbtn { padding: 0 24px; }
.ors-ibtn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); flex: none; transition: background-color 80ms linear; }
.ors-ibtn:hover { background: var(--hover); }

/* _InfoRow */
.ors-row { display: flex; align-items: center; min-height: 40px; padding: 10px 0; }
.ors-label { width: 140px; flex: none; font-size: 13px; font-weight: 500; color: var(--text-2); }
.ors-value { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.ors-logo-cell { display: flex; align-items: center; gap: 16px; }
.ors-upload { cursor: pointer; }
.ors-upload.is-busy { opacity: .6; pointer-events: none; }

.ors-input { width: 100%; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-light); font-size: 14px; outline: none; }
.ors-input:focus { border-color: var(--primary); }
.ors-input::placeholder { color: var(--muted); }
.ors-input-lg { height: 42px; }
.ors-select { position: relative; display: flex; align-items: center; }
.ors-select select { appearance: none; width: 100%; height: 36px; padding: 0 36px 0 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-light); font-size: 14px; outline: none; cursor: pointer; }
.ors-select select:focus { border-color: var(--primary); }
.ors-select .ic { position: absolute; right: 8px; pointer-events: none; color: var(--text-2); }
.ors-select-lg select { height: 42px; }
.ors-error { margin-top: 12px; font-size: 12px; color: var(--error); }

/* _MemberRow, _InviteRow */
.ors-member, .ors-invite { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.ors-member + .ors-member, .ors-invite + .ors-invite { border-top: 1px solid var(--border); }
.ors-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-light); border: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.ors-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ors-who-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.ors-who-email { font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.ors-you { flex: none; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); font-size: 10px; font-weight: 500; line-height: 1.2; letter-spacing: 0; }
.ors-mail { color: var(--text-2); flex: none; }
.ors-expiry { font-size: 11px; color: var(--muted); }
.ors-expiry.is-gone { color: var(--error); }
/* Flutter: the badge, 8px, then IconButtons with no gap between them */
.ors-role + .ors-ibtn, .ors-role-pick + .ors-ibtn { margin-left: -4px; }
.ors-ibtn + .ors-ibtn { margin-left: -12px; }

/* _RoleBadge: the role's colour at 15% behind it, 30% around it */
.ors-role { --c: var(--muted); flex: none; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; line-height: 1.2; letter-spacing: 0; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.ors-role[data-role="owner"] { --c: var(--warning); }
.ors-role[data-role="admin"] { --c: var(--primary); }
.ors-role[data-role="member"] { --c: var(--success); }

/* _RoleDropdown */
.ors-role-pick { position: relative; flex: none; display: flex; align-items: center; }
.ors-role-pick select { appearance: none; height: 30px; padding: 0 30px 0 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-light); font-size: 12px; outline: none; cursor: pointer; }
.ors-role-pick select:focus { border-color: var(--primary); }
.ors-role-pick .ic { position: absolute; right: 4px; pointer-events: none; color: var(--text-2); }

.ors-spin { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: ors-spin 700ms linear infinite; display: block; }
.ors-spin-light { width: 16px; height: 16px; border-width: 2px; color: #fff; }
@keyframes ors-spin { to { transform: rotate(360deg); } }

/* AlertDialog (theme: surface, radius 12, a border) */
.ors-scrim { position: fixed; inset: 0; z-index: 72; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .54); }
.ors-dlg { width: min(468px, 100%); max-height: calc(100dvh / var(--zoom) - 48px); overflow: auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 11px 15px rgba(0, 0, 0, .2), 0 24px 38px rgba(0, 0, 0, .14); }
.ors-dlg h2 { margin: 0 0 16px; font-size: 16px; font-weight: 400; -webkit-text-stroke: .4px currentColor; line-height: 1.43; letter-spacing: .15px; }
.ors-dlg-text { margin: 0; font-size: 14px; color: var(--text-2); }
.ors-dlg-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 24px; }
.ors-field-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-2); }
.ors-gap { margin-top: 16px; }
.ors-created-for { margin: 0 0 12px; font-size: 14px; }
.ors-created-help { margin: 0 0 8px; font-size: 12px; color: var(--text-2); line-height: 1.43; }
.ors-link-box { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-light); }
.ors-link { flex: 1; min-width: 0; font: 12px/1.4 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0; overflow-wrap: anywhere; user-select: all; }

/* SnackBar: the theme's surface one; the copy-link one is floating green */
.ors-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-modal); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.ors-toast { display: flex; align-items: center; gap: 8px; min-width: 288px; padding: 14px 16px; border-radius: 4px; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--menu-shadow); font-size: 14px; animation: swapin 160ms var(--ease-out) both; }
.ors-toast[data-kind="ok"] { background: var(--success); border-color: var(--success); color: #fff; }
.ors-toast[data-kind="bad"] { background: var(--error); border-color: var(--error); color: #fff; }
.ors-toast-ic { display: flex; }

/* A phone: Flutter has no top bar to host the title, so the old heading
   comes back, 32px above the first card; the screen keeps its 32px padding. */
@media (max-width: 767.98px), (pointer: coarse) {
  .ors { padding: 16px 16px 32px; margin-left: 0; }
  .ors-heading { display: flex; }
  .ors-toast { min-width: 0; }
}

/* Narrow column (a phone, or the prototype shell's sidebar left open beside
   the page): rows stack, actions wrap under the name. Flutter's Row keeps
   the 140px label and squeezes the value; these keep it readable. */
@container ors (max-width: 520px) {
  .ors-card-head { flex-wrap: wrap; padding: 16px 12px 12px 16px; }
  .ors-card-body { padding: 12px 16px 16px; }
  .ors-row { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 0; }
  .ors-label { width: auto; }
  .ors-value { width: 100%; }
  .ors-logo-cell { flex-wrap: wrap; gap: 10px; }
  .ors-member, .ors-invite { flex-wrap: wrap; gap: 8px 12px; padding: 12px 0; }
  .ors-member .ors-who, .ors-invite .ors-who { flex-basis: calc(100% - 48px); }
  .ors-member .ors-role, .ors-member .ors-role-pick, .ors-invite .ors-role { margin-left: 48px; }
  .ors-heading-text b { font-size: 20px; }
}

/* Teams: the pill beside a member and the Equipos card. Tones as Plan
   colaborativo's areas (planning/web/static/stages.css). */
.ors-team { --c: #5D6D7E; flex: none; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; line-height: 1.2; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); white-space: nowrap; }
.ors-team[data-tone="a1"] { --c: #1976D2; }
.ors-team[data-tone="a2"] { --c: #C2185B; }
.ors-team[data-tone="a3"] { --c: #00897B; }
.ors-team[data-tone="a4"] { --c: #5D6D7E; }
.ors-team[data-tone="a5"] { --c: #B26A00; }
[data-theme="dark"] .ors-team[data-tone="a1"] { --c: #64B5F6; }
[data-theme="dark"] .ors-team[data-tone="a2"] { --c: #F48FB1; }
[data-theme="dark"] .ors-team[data-tone="a3"] { --c: #4DB6AC; }
[data-theme="dark"] .ors-team[data-tone="a4"] { --c: #AEB6BF; }
[data-theme="dark"] .ors-team[data-tone="a5"] { --c: #FFB74D; }
.ors-teamrow { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.ors-teamrow + .ors-teamrow { border-top: 1px solid var(--border); }
.ors-teamrow .ors-team { min-width: 120px; text-align: center; }
.ors-team-who { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.ors-team-n { flex: none; font-size: 12px; color: var(--text-2); }
@media (max-width: 640px) {
  .ors-member .ors-team { margin-left: 48px; }
  .ors-teamrow { flex-wrap: wrap; gap: 6px 12px; }
}
