:root {
    --green: #1f7a3d;
    --green-dark: #145a2b;
    --gold: #d4a017;
    --bg: #f5f7f5;
    --text: #222;
    --muted: #666;
    --border: #d9e2d9;
}
* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}
a { color: var(--green); }
.site-header {
    background: #fff;
    border-bottom: 3px solid var(--green);
    padding: 10px 20px;
}
.header-inner { display: flex; align-items: center; gap: 12px; max-width: 1100px; margin: 0 auto; }
.logo-header { height: 48px; }
.brand-text { font-weight: 700; color: var(--green-dark); font-size: 1.1rem; }
.site-footer {
    text-align: center; padding: 20px; font-size: .85rem;
    color: var(--muted); border-top: 1px solid var(--border); margin-top: 40px;
}
.container { max-width: 1000px; margin: 30px auto; padding: 0 20px; }

/* Hero */
.hero { text-align: center; padding: 60px 20px 40px; }
.hero .logo-main { height: 90px; margin-bottom: 20px; }
.hero h1 { color: var(--green-dark); font-size: 2.4rem; margin: 0; }
.hero .subtitle { color: var(--gold); font-size: 1.2rem; font-weight: 600; margin-top: 4px; }
.hero .tagline { max-width: 700px; margin: 20px auto; color: var(--muted); }
.btn-primary, .btn-secondary {
    display: inline-block; padding: 12px 26px; border-radius: 6px;
    text-decoration: none; font-weight: 600; border: none; cursor: pointer;
    margin: 8px 6px; font-size: 1rem;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: #fff; color: var(--green); border: 2px solid var(--green); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; padding: 20px; max-width: 1000px; margin: 0 auto 60px; }
.feature-card { background: #fff; padding: 24px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.06); border-top: 4px solid var(--gold); }
.feature-card h3 { color: var(--green-dark); margin-top: 0; }

/* Agreement */
.agreement-header { text-align: center; margin-bottom: 30px; }
.agreement-header .logo-sm { height: 60px; }
.agreement-header h2 { color: var(--green-dark); }
.agreement-body { background: #fff; padding: 30px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.agreement-body h3 { color: var(--green-dark); border-bottom: 2px solid var(--gold); padding-bottom: 6px; margin-top: 28px; }
.agreement-body ul { padding-left: 22px; }
.agreement-body li { margin-bottom: 6px; }
.channel-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.channel-table td { border: 1px solid var(--border); padding: 8px 12px; }

/* Signature form */
.signature-form fieldset {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 20px; margin: 24px 0;
}
.signature-form legend { font-weight: 700; color: var(--green-dark); padding: 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.signature-form label { display: block; font-weight: 600; margin-bottom: 12px; font-size: .92rem; }
.signature-form input[type=text], .signature-form input[type=number], .signature-form select {
    width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: .95rem; margin-top: 4px;
}
.signature-pad {
    display: block; width: 100%; height: 160px; background: #fdfdfd;
    border: 2px dashed var(--green); border-radius: 8px; touch-action: none; cursor: crosshair;
}
.btn-clear { margin-top: 8px; padding: 6px 14px; background: #eee; border: 1px solid #ccc; border-radius: 6px; cursor: pointer; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-weight: 500; }
.checkbox input { margin-top: 4px; }
.hint { color: var(--muted); font-size: .85rem; }
.optional { background: #f9fbf9; }
.form-actions { text-align: center; margin: 30px 0; }

/* Success */
.success-page { text-align: center; padding: 60px 20px; }
.success-icon {
    width: 80px; height: 80px; border-radius: 50%; background: var(--green);
    color: #fff; font-size: 3rem; line-height: 80px; margin: 0 auto 20px;
}
.ref-box { background: #fff; display: inline-block; padding: 14px 24px; border-radius: 8px; border: 2px solid var(--gold); font-size: 1.1rem; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08); width: 100%; max-width: 380px; text-align: center; }
.login-box h2 { color: var(--green-dark); }
.login-box label { display: block; text-align: left; margin-bottom: 14px; font-weight: 600; }
.login-box input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; }
.login-box button { width: 100%; margin-top: 10px; }
.link-back { display: block; margin-top: 16px; font-size: .85rem; }
.alert { background: #ffe5e5; color: #a00; padding: 10px; border-radius: 6px; margin-bottom: 12px; }
.alert-success { background: #e5f7ea; color: #145a2b; padding: 12px; border-radius: 6px; margin-bottom: 16px; }

/* Admin */
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.admin-topbar h2 { color: var(--green-dark); margin: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 20px; border-radius: 10px; text-align: center; border-left: 4px solid var(--green); box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.stat-card span { display: block; color: var(--muted); font-size: .85rem; }
.stat-card strong { font-size: 1.8rem; color: var(--green-dark); }
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 10px; border: 1px solid var(--border); border-radius: 6px; flex: 1; min-width: 180px; }
.data-table { width: 100%; background: #fff; border-collapse: collapse; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.data-table th { background: var(--green); color: #fff; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-success { background: #d4f5dd; color: #145a2b; }
.badge-warn { background: #fff3cd; color: #8a6d00; }
.btn-sm { padding: 5px 12px; background: var(--green); color: #fff; border-radius: 5px; text-decoration: none; font-size: .85rem; }
.detail-card { background: #fff; padding: 22px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.detail-card h3 { color: var(--green-dark); margin-top: 0; border-bottom: 2px solid var(--gold); padding-bottom: 6px; }
.detail-table { width: 100%; }
.detail-table th { text-align: left; width: 220px; padding: 6px 0; color: var(--muted); font-weight: 600; }
.detail-table td { padding: 6px 0; }
.signature-img { max-width: 320px; border: 1px solid var(--border); border-radius: 6px; background: #fdfdfd; }
.endorse-form label { display: block; margin-bottom: 12px; font-weight: 600; }
.endorse-form input[type=text] { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; }

@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.8rem; }
}