/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --background: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3f7;
  --ink: #172026;
  --muted: #5f6f7a;
  --line: #d7e0e7;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --danger-dark: #8f1d14;
  --warning: #a35b00;
  --shadow: 0 16px 38px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
}

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

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.app-shell--narrow {
  width: min(680px, calc(100% - 32px));
}

.topbar,
.account-nav,
.section-heading,
.punishment-card__main {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1,
.section-heading h2,
.punishment-card h3,
.child-row h3,
.empty-state h3,
.error-panel h3 {
  margin: 0;
  line-height: 1.1;
}

.topbar h1 {
  font-size: 2rem;
}

.eyebrow,
.today,
.summary-strip p,
.punishment-card p,
.punishment-meta dt,
.account-nav span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.today {
  margin: 8px 0 0;
}

.account-nav {
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.locale-switcher {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.locale-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.locale-link + .locale-link {
  border-left: 1px solid var(--line);
}

.locale-link--active {
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.summary-strip div {
  min-height: 88px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-strip span {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
}

.summary-strip p {
  margin: 4px 0 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
}

.punishment-column {
  min-width: 0;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 1.2rem;
}

.punishment-list,
.compact-list {
  display: grid;
  gap: 12px;
}

.punishment-card,
.child-row,
.form-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.punishment-card {
  padding: 18px;
}

.punishment-card__main {
  justify-content: space-between;
  gap: 16px;
}

.punishment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.punishment-card h3 {
  margin-top: 8px;
  font-size: 1.18rem;
}

.punishment-card p {
  margin: 8px 0 0;
}

.punishment-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.punishment-meta div {
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.punishment-meta dt {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.punishment-meta dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill--active {
  background: #d8f3ef;
  color: var(--primary-dark);
}

.status-pill--scheduled {
  background: #fff0d6;
  color: var(--warning);
}

.status-pill--revoked,
.status-pill--expired {
  background: #f1f3f5;
  color: #687782;
}

.secondary-lists {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

.secondary-lists h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.compact-list .punishment-card {
  box-shadow: none;
}

.archive-section {
  margin-top: 28px;
}

.archive-section details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.archive-section summary {
  display: flex;
  min-height: 56px;
  align-items: center;
  padding: 0 18px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.archive-section .compact-list,
.archive-section .empty-state {
  margin: 0 18px 18px;
}

.form-panel {
  padding: 20px;
}

.punishment-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

label,
.checkbox-group legend {
  font-weight: 800;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.checkbox-group {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
}

.checkbox-group legend {
  padding: 0;
}

.checkbox-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--surface-muted);
  cursor: pointer;
}

.checkbox-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.checkbox-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.checkbox-option small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.empty-inline {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-muted);
}

.empty-inline p {
  margin: 0;
  color: var(--muted);
}

.date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.duration-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.duration-buttons button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.duration-buttons button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button--primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
}

.button--primary:hover {
  background: var(--primary-dark);
}

.button--secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--primary-dark);
}

.button--ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button--danger {
  background: var(--danger);
  color: #fff;
}

.button--danger:hover {
  background: var(--danger-dark);
}

.empty-state {
  padding: 30px;
}

.empty-state--compact {
  box-shadow: none;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

.error-panel {
  border: 1px solid #f1b7b0;
  border-radius: 8px;
  padding: 14px;
  background: #fff1ef;
  color: var(--danger-dark);
}

.error-panel ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.child-manager {
  margin-bottom: 28px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.inline-form .error-panel {
  grid-column: 1 / -1;
}

.children-section {
  display: grid;
  gap: 12px;
}

.child-list {
  display: grid;
  gap: 12px;
}

.child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.child-row h3 {
  font-size: 1.05rem;
}

.child-row p {
  margin: 6px 0 0;
  color: var(--muted);
}

.sharing-panel,
.sharing-section {
  margin-bottom: 28px;
}

.sharing-list {
  display: grid;
  gap: 12px;
}

.sharing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sharing-row h3 {
  margin: 0;
  font-size: 1.05rem;
}

.sharing-row p {
  margin: 6px 0 0;
  color: var(--muted);
}

.flash-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 36px));
}

.flash {
  margin: 0;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.flash--notice {
  border: 1px solid #bde8df;
  background: #e5fbf6;
  color: var(--primary-dark);
}

.flash--alert {
  border: 1px solid #f1b7b0;
  background: #fff1ef;
  color: var(--danger-dark);
}

body:has(.new_user),
body:has(.edit_user) {
  display: grid;
  place-items: center;
  padding: 24px;
}

.new_user,
.edit_user {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.new_user .field,
.edit_user .field {
  margin-bottom: 14px;
}

.new_user input[type="submit"],
.edit_user input[type="submit"] {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(430px, 100%);
}

body:has(.new_user) h2,
body:has(.edit_user) h2 {
  width: min(430px, 100%);
  margin: 0;
}

@media (max-width: 880px) {
  .dashboard-grid,
  .date-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-nav {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .summary-strip,
  .punishment-meta,
  .checkbox-options,
  .duration-buttons {
    grid-template-columns: 1fr;
  }

  .punishment-card__main,
  .punishment-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form,
  .child-row,
  .sharing-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .inline-form {
    display: grid;
  }

  .child-row,
  .sharing-row {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .locale-switcher {
    width: 100%;
  }

  .locale-link {
    flex: 1;
  }
}
