/* Базовая типографика и layout */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont,
              "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 15px;
              color: #1f2937; background: #f5f7fb; }
body { min-height: 100vh; display: flex; flex-direction: column; }

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* Top bar */
.topbar { background: #1e293b; color: #fff; padding: 12px 24px; }
.topbar a { color: #cbd5e1; }
.topbar a:hover { color: #fff; }
.topbar-inner { display: flex; align-items: center; gap: 24px; max-width: 1200px; margin: 0 auto; }
.brand { color: #fff !important; font-weight: 600; font-size: 18px; }
.topnav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.topnav .who { color: #cbd5e1; font-size: 13px; }
.topnav .who em { background: #f59e0b; color: #1e293b; padding: 1px 6px;
                  border-radius: 8px; font-style: normal; font-size: 11px; font-weight: 600; }
.logout-form { display: inline; margin: 0; }
.link-btn { background: none; border: none; color: #cbd5e1; cursor: pointer; padding: 0;
            text-decoration: underline; font: inherit; }
.link-btn:hover { color: #fff; }

/* Main */
.main { max-width: 1100px; width: 100%; margin: 24px auto; padding: 0 16px; flex: 1; }
.footer { text-align: center; padding: 18px; color: #64748b; font-size: 13px; }

/* Headings */
h1 { margin: 0 0 18px; font-size: 26px; }
h2 { margin: 18px 0 12px; font-size: 19px; }
h3 { margin: 14px 0 8px; font-size: 16px; color: #475569; }

.muted { color: #64748b; }
.empty { color: #64748b; font-style: italic; }
.req { color: #dc2626; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Login box */
.login-box { max-width: 380px; margin: 60px auto; background: #fff;
             border: 1px solid #e2e8f0; border-radius: 12px; padding: 28px; }
.login-box label { display: block; margin-bottom: 12px; font-size: 13px; color: #475569; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1;
                   border-radius: 6px; font-size: 14px; margin-top: 4px; }
.login-box input:focus { outline: 2px solid #2563eb; border-color: #2563eb; }

/* Index of acts */
.act-grid { list-style: none; padding: 0; display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 18px; margin: 0; }
.act-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
            padding: 18px; }
.act-card h2 { margin: 6px 0; font-size: 17px; }
.act-icon { font-size: 30px; }

/* Sections of form */
.section { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
           margin-bottom: 14px; }
.section > summary { padding: 14px 18px; cursor: pointer; font-weight: 600;
                      font-size: 15px; user-select: none; list-style: none;
                      display: flex; align-items: baseline; gap: 8px; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::before { content: "▶"; font-size: 11px; color: #64748b;
                              display: inline-block; transition: transform .15s;
                              margin-right: 4px; }
.section[open] > summary::before { transform: rotate(90deg); }
.section > summary .num { color: #94a3b8; font-weight: 500; }
.section-body { padding: 0 18px 18px; border-top: 1px solid #f1f5f9;
                padding-top: 14px; }

/* Fields */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: #334155;
                margin-bottom: 4px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1;
  border-radius: 6px; font: inherit; font-size: 14px;
  background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid #2563eb; border-color: #2563eb;
}
.field textarea { resize: vertical; min-height: 60px; }

/* Rows table for repeating sections */
.rows-table { width: 100%; border-collapse: collapse; margin: 8px 0 6px; }
.rows-table th { background: #f1f5f9; font-weight: 600; font-size: 12px;
                  text-align: left; color: #475569; padding: 6px 8px;
                  border-bottom: 1px solid #cbd5e1; }
.rows-table td { vertical-align: top; padding: 4px 6px; }
.rows-table td input, .rows-table td textarea, .rows-table td select {
  width: 100%; padding: 6px 8px; border: 1px solid #cbd5e1;
  border-radius: 4px; font: inherit; font-size: 13px;
}
.rows-table .row-del { background: transparent; border: 1px solid #cbd5e1;
                       color: #dc2626; border-radius: 4px;
                       padding: 2px 8px; cursor: pointer; font-size: 14px; }
.rows-table .row-del:hover { background: #fee2e2; }

/* Buttons */
.btn { display: inline-block; background: #2563eb; color: #fff !important;
       border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer;
       font: inherit; font-size: 14px; text-decoration: none; }
.btn:hover { background: #1d4ed8; }
.btn.primary { font-size: 16px; padding: 12px 22px; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.add-row { margin: 6px 0 12px; background: #16a34a; }
.add-row:hover { background: #15803d; }

.actions { margin-top: 24px; text-align: center; }

/* Users admin */
.users { width: 100%; border-collapse: collapse; }
.users th, .users td { text-align: left; padding: 8px 10px;
                        border-bottom: 1px solid #e2e8f0; font-size: 14px; }
.users th { background: #f8fafc; font-size: 12px; text-transform: uppercase;
            color: #64748b; letter-spacing: 0.04em; }
.add-user { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
             padding: 14px 18px; margin-bottom: 18px; }
.add-user .row { display: grid; grid-template-columns: 1fr 1fr 100px auto;
                  gap: 10px; align-items: end; }
.add-user label { font-size: 12px; color: #475569; }
.add-user input, .add-user select { width: 100%; padding: 6px 8px;
                                     border: 1px solid #cbd5e1; border-radius: 4px; }

.danger { color: #dc2626; background: transparent; border: 1px solid #fecaca;
          border-radius: 4px; padding: 3px 8px; cursor: pointer; font: inherit;
          font-size: 13px; }
.danger:hover { background: #fee2e2; }
