:root {
  --grfca-bg: #f4f8f4;
  --grfca-card: #ffffff;
  --grfca-border: #d8e6d8;
  --grfca-text: #1f3324;
  --grfca-muted: #5d7060;
  --grfca-primary: #1f6b46;
  --grfca-primary-dark: #165438;
  --grfca-accent: #caa55d;
  --grfca-danger: #b43a3a;
  --grfca-danger-bg: #fff2f2;
  --grfca-success-bg: #ecf8ef;
  --grfca-shadow: 0 10px 28px rgba(20, 62, 35, 0.08);
  --grfca-radius: 16px;
}

.grfca {
  color: var(--grfca-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.grfca *, .grfca *::before, .grfca *::after { box-sizing: border-box; }

.grfca-panel,
.grfca-card,
.grfca-empty-card {
  background: var(--grfca-card);
  border: 1px solid var(--grfca-border);
  border-radius: var(--grfca-radius);
  box-shadow: var(--grfca-shadow);
}

.grfca-admin,
.grfca-public,
.grfca-public-table {
  display: grid;
  gap: 20px;
}

.grfca-panel { padding: 22px; }
.grfca-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.grfca-panel__head h2,
.grfca-card h3 { margin: 0; }

.grfca-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef6ef;
  color: var(--grfca-primary);
  border: 1px solid #d4e7d6;
  font-size: 12px;
  font-weight: 700;
}

.grfca-alert {
  padding: 14px 16px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid var(--grfca-border);
}
.grfca-alert--success {
  background: var(--grfca-success-bg);
  color: var(--grfca-primary-dark);
}
.grfca-alert--error {
  background: var(--grfca-danger-bg);
  color: #8f2424;
  border-color: #edcccc;
}

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

.grfca-field { display: grid; gap: 8px; }
.grfca-field label {
  font-weight: 700;
  font-size: 13px;
  color: var(--grfca-text);
}
.grfca-field input[type="text"],
.grfca-field input[type="date"],
.grfca-field input[type="file"],
.grfca-field select,
.grfca-toolbar__search input[type="text"],
.grfca-nav-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bfd3c0;
  border-radius: 10px;
  background: #fff;
  color: var(--grfca-text);
}

.grfca-editor-wrap {
  border: 1px solid var(--grfca-border);
  border-radius: 14px;
  overflow: hidden;
}

.grfca-actions,
.grfca-row-actions,
.grfca-toolbar,
.grfca-toolbar__group,
.grfca-toolbar__search,
.grfca-card__head,
.grfca-card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.grfca-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.grfca-btn,
.grfca-inline-button,
.grfca-inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: .2s ease;
  font-weight: 700;
}

.grfca-btn--primary {
  background: var(--grfca-primary);
  color: #fff;
  border: 1px solid var(--grfca-primary);
}
.grfca-btn--primary:hover { background: var(--grfca-primary-dark); border-color: var(--grfca-primary-dark); }
.grfca-btn--ghost,
.grfca-inline-button,
.grfca-inline-link {
  background: #f5faf6;
  color: var(--grfca-primary-dark);
  border: 1px solid #d3e4d6;
}
.grfca-inline-button { min-height: 34px; padding: 0 10px; }
.grfca-inline-button:hover,
.grfca-inline-link:hover,
.grfca-btn--ghost:hover { background: #edf6ee; }

.grfca-inline-button {
  appearance: none;
  -webkit-appearance: none;
}

.grfca-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--grfca-border);
  border-radius: 14px;
}

.grfca-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.grfca-table th,
.grfca-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #e4eee5;
  text-align: left;
  vertical-align: top;
}
.grfca-table th {
  background: #f0f7f1;
  color: var(--grfca-primary-dark);
  font-weight: 800;
  white-space: nowrap;
}
.grfca-table tbody tr:hover { background: #fafdfb; }

.grfca-empty,
.grfca-empty-card { text-align: center; color: var(--grfca-muted); padding: 26px; }
.grfca-empty-card { font-weight: 600; }
.grfca-muted { color: var(--grfca-muted); }

.grfca-results-meta {
  color: var(--grfca-muted);
  font-weight: 600;
}

.grfca-cards {
  display: grid;
  gap: 18px;
}

.grfca-card {
  padding: 22px;
}
.grfca-card__meta {
  color: var(--grfca-muted);
  font-weight: 600;
  margin-top: 4px;
  margin-bottom: 12px;
}
.grfca-card__content {
  line-height: 1.6;
}

.grfca-pagination {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.grfca-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  margin: 0 4px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #d6e6d8;
  background: #fff;
  color: var(--grfca-primary-dark);
  text-decoration: none;
  font-weight: 700;
}
.grfca-pagination .current {
  background: var(--grfca-primary);
  color: #fff;
  border-color: var(--grfca-primary);
}

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

@media (max-width: 720px) {
  .grfca-grid--4 { grid-template-columns: 1fr; }
  .grfca-panel { padding: 16px; }
  .grfca-card { padding: 16px; }
  .grfca-toolbar { align-items: stretch; }
  .grfca-toolbar__group,
  .grfca-toolbar__search { width: 100%; }
}

.grfca.is-loading{opacity:.72;pointer-events:none;transition:opacity .2s ease}
.grfca-listing[aria-busy="true"]{position:relative}
.grfca-listing[aria-busy="true"]::after{content:"";position:absolute;inset:0;background:rgba(255,255,255,.45);backdrop-filter:blur(1px)}

.grfca-panel--form{position:relative}
.grfca-panel__topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:18px}
.grfca-panel__title{margin:0 0 6px 0}
.grfca-panel__subtitle{margin:0;color:var(--grfca-muted)}
.grfca-form-shell{display:grid;gap:14px}
.grfca-toast-stack{position:fixed;right:18px;bottom:18px;z-index:9999;display:grid;gap:10px;max-width:min(360px,calc(100vw - 32px))}
.grfca-toast{opacity:0;transform:translateY(8px);transition:.22s ease;padding:14px 16px;border-radius:14px;box-shadow:var(--grfca-shadow);border:1px solid var(--grfca-border);background:#fff;color:var(--grfca-text);font-weight:700}
.grfca-toast.is-visible{opacity:1;transform:translateY(0)}
.grfca-toast--success{background:var(--grfca-success-bg);color:var(--grfca-primary-dark)}
.grfca-toast--error{background:var(--grfca-danger-bg);color:#8f2424;border-color:#edcccc}

@media (max-width: 720px) {
  .grfca-toast-stack{left:16px;right:16px;bottom:16px;max-width:none}
}

.grfca-help{margin:6px 0 0;color:var(--grfca-muted);font-size:12px;line-height:1.5;}
.grfca-folder-box{display:grid;gap:8px;padding:12px;border:1px solid var(--grfca-border);border-radius:12px;background:#f8fbf8;min-height:44px;}

.grfca-panel--form,
.grfca-panel--listing {
  position: relative;
}

.grfca-panel__topbar {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
  flex-wrap:wrap;
}

.grfca-panel__title {
  margin:0 0 4px;
}

.grfca-panel__subtitle {
  margin:0;
  color:var(--grfca-muted);
}

.grfca-help,
.grfca-folder-box {
  font-size:13px;
  color:var(--grfca-muted);
}

.grfca-folder-box {
  padding:12px;
  border:1px solid var(--grfca-border);
  border-radius:12px;
  background:#f9fcf9;
  max-height:160px;
  overflow:auto;
}

.grfca-toast-stack {
  position:fixed;
  right:20px;
  bottom:20px;
  z-index:99999;
  display:grid;
  gap:10px;
}

.grfca-toast {
  opacity:0;
  transform:translateY(8px);
  transition:.2s ease;
  min-width:260px;
  max-width:360px;
  padding:14px 16px;
  border-radius:12px;
  color:#fff;
  box-shadow:0 12px 28px rgba(0,0,0,.18);
  font-weight:700;
}

.grfca-toast.is-visible {
  opacity:1;
  transform:translateY(0);
}

.grfca-toast--success { background: var(--grfca-primary); }
.grfca-toast--error { background: var(--grfca-danger); }

.grfca.is-loading {
  opacity:.72;
}

@media (max-width: 720px) {
  .grfca-toast-stack {
    right:12px;
    left:12px;
    bottom:12px;
  }

  .grfca-toast {
    min-width:0;
    max-width:none;
    width:100%;
  }
}
