:root {
  --color-bg: #f4f6f9;
  --color-surface: #fff;
  --color-text: #1a1d23;
  --color-muted: #5c6578;
  --color-primary: #1d5bbf;
  --color-primary-hover: #164a99;
  --color-border: #d8dee8;
  --color-success: #0d7a4a;
  --color-error: #b42318;
  --radius: 8px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-logo {
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.app-header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.tenant-badge {
  padding: 0.2rem 0.5rem;
  background: #e8eef8;
  border-radius: 4px;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 120px);
}

.app-nav {
  width: 220px;
  padding: 1rem;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

.app-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-nav a {
  display: block;
  padding: 0.4rem 0;
  color: var(--color-text);
  text-decoration: none;
}

.app-nav a:hover {
  color: var(--color-primary);
}

.locale-select-wrap {
  display: inline-flex;
  align-items: center;
}

.locale-select {
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  min-width: 8.5rem;
}

.locale-select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-main {
  flex: 1;
  padding: 1.5rem;
}

.app-footer {
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-card-locale {
  display: flex;
  justify-content: flex-end;
  margin: -0.5rem 0 0.75rem;
}

.auth-brand {
  margin: 0 0 0.5rem;
  text-align: center;
  color: var(--color-primary);
}

.auth-tagline {
  text-align: center;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.field input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.hint {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
  border: 1px solid var(--color-error);
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.card-danger {
  border-color: #f5c2c0;
  background: #fff8f7;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.field.checkbox label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: normal;
}

.field.checkbox input {
  margin-top: 0.25rem;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
}

.btn-block {
  width: 100%;
}

.inline-form {
  display: inline;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.alert-success {
  background: #e6f4ed;
  color: var(--color-success);
}

.alert-error {
  background: #fdecea;
  color: var(--color-error);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.error-detail {
  background: #f8f8f8;
  padding: 1rem;
  overflow: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.filter-bar input[type="search"] {
  min-width: 220px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.filter-bar select {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.form-card {
  max-width: 520px;
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-list {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.5rem 1rem;
  background: var(--color-surface);
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.detail-list dt {
  font-weight: 500;
  color: var(--color-muted);
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}

.badge-success { background: #e6f4ed; color: var(--color-success); }
.badge-danger { background: #fdecea; color: var(--color-error); }
.badge-warn { background: #fff4e5; color: #9a6700; }
.badge-muted { background: #eef0f4; color: var(--color-muted); }

.actions a {
  margin-right: 0.75rem;
}

.status-expired { color: var(--color-error); font-weight: 500; }
.status-missing { color: var(--color-muted); }
.status-approved { color: var(--color-success); }
.status-submitted { color: var(--color-primary); }
.status-in_review { color: #9a6700; }

.card-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.detail-list-compact {
  margin-bottom: 1rem;
}

.inline-actions,
.review-actions .inline-form {
  display: inline-block;
  margin-right: 0.5rem;
  margin-bottom: 1rem;
}

.reject-form {
  margin-top: 1rem;
  max-width: 480px;
}

textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
}
