<div class="login-card">
    <div class="login-brand"><span class="brand-mark"><?php echo admin_icon('snowflake', 20); ?></span> 酷冰甲 · 降温服</div>
    <h1>后台登录</h1>
    <p class="sub">请输入管理员账号密码</p>
    <?php if ($error): ?><div class="alert alert-err"><?php echo e($error); ?></div><?php endif; ?>
    <form method="post" action="<?php echo site_url('admin/login'); ?>" autocomplete="on">
        <?php echo csrf_field(); ?>
        <div class="field"><label>账号</label><input name="username" required autofocus autocomplete="username" maxlength="32" placeholder="请输入账号"></div>
        <div class="field"><label>密码</label><input type="password" name="password" required autocomplete="current-password" maxlength="64" placeholder="请输入密码"></div>
        <div class="field">
            <label>验证码</label>
            <div style="display:flex;align-items:center;gap:12px">
                <input name="captcha" required inputmode="text" autocomplete="off" maxlength="4" placeholder="请输入验证码" style="flex:1;text-transform:uppercase">
                <img id="captchaImg" src="<?php echo e($captcha['url']); ?>" alt="验证码" title="点击刷新" style="width:130px;height:44px;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;vertical-align:middle">
            </div>
        </div>
        <button class="btn-primary" style="width:100%" type="submit">登 录</button>
    </form>
    <script>
    document.getElementById('captchaImg').addEventListener('click', function() {
        this.src = '<?php echo e($captcha['url']); ?>'.replace(/_t=\w+/, '_t=' + Date.now().toString(16));
    });
    </script>
    <p class="muted" style="margin-top:16px;font-size:13px;display:flex;align-items:center;gap:6px"><?php echo admin_icon('shield', 15); ?> 请使用分配的账号登录；忘记密码请联系超级管理员重置</p>
</div>
