* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
       background: #f4f5f3; color: #1f2421; font-size: 14px; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
.app { display: flex; min-height: 100vh; }

.sidebar { width: 230px; background: #1d2b24; color: #dfe8e2; padding: 24px 18px;
           display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center;
              width: 38px; height: 38px; border-radius: 9px; background: #3f6b55;
              color: #fff; font-family: Georgia, serif; font-size: 20px; font-weight: bold; }
.brand b { display: block; font-size: 15px; }
.brand small { color: #8fa79a; font-size: 11px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { padding: 10px 14px; border-radius: 7px; color: #b9c9bf; }
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: #3f6b55; color: #fff; }
.logout { padding: 10px 14px; color: #8fa79a; font-size: 12px; border-top: 1px solid rgba(255,255,255,.1); }

.main { flex: 1; padding: 34px 40px 60px; max-width: 1080px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
h1 { font-family: Georgia, 'Songti SC', serif; font-size: 26px; color: #16211b; }
h2 { font-size: 15px; margin-bottom: 14px; color: #243329; }
.muted { color: #7d857f; font-size: 13px; }
.hint { color: #8a8a84; font-size: 12px; margin-top: 12px; line-height: 1.7; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.card { background: #fff; border: 1px solid #e5e7e2; border-radius: 10px; padding: 20px; }
.card-num { font-family: Georgia, serif; font-size: 32px; color: #2f4f43; }
.card-label { color: #7d857f; font-size: 12px; margin-top: 4px; }

.panel { background: #fff; border: 1px solid #e5e7e2; border-radius: 10px;
         padding: 22px 24px; margin-bottom: 18px; }
.actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 7px; border: 1px solid #cfd6d0;
       background: #fff; color: #2f4f43; cursor: pointer; font-size: 13px; }
.btn:hover { background: #f3f6f4; }
.btn.primary { background: #2f4f43; color: #fff; border-color: #2f4f43; }
.btn.primary:hover { background: #253f35; }
.btn.save { margin-top: 8px; }
.btn.danger { color: #a33a30; border-color: #e4c4bf; background: #fff; }
.btn.danger:hover { background: #fdf2f0; border-color: #d9a9a2; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef0ec; }
th { color: #7d857f; font-weight: 500; }
tbody tr:hover { background: #fafbf9; }
td { color: #37413a; }
.empty { text-align: center; color: #a0a8a2; padding: 30px; }
table.kv th { width: 130px; color: #5d675f; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; }
.badge.ok { background: #e5f2ea; color: #2f6b48; }
.badge.err { background: #f9e5e3; color: #a33a30; }
.badge.run { background: #fbf1dc; color: #946a17; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #5d675f; }
label.wide { margin-top: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; margin-top: 16px; }
input[type=text], input[type=password], input:not([type]) { width: 100%; padding: 9px 11px;
       border: 1px solid #d6dbd5; border-radius: 6px; font-size: 13px; background: #fcfdfc; }
input:focus { outline: none; border-color: #3f6b55; }
.linkform { display: flex; gap: 10px; flex-wrap: wrap; }
.linkform input { flex: 1; min-width: 260px; padding: 10px 12px; border: 1px solid #d6ddd8; border-radius: 6px; font-size: 14px; font-family: inherit; }
.provider-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.provider-row select, select { padding: 9px 12px; border: 1px solid #d6ddd8; border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff; }
textarea { padding: 10px 12px; border: 1px solid #d6ddd8; border-radius: 6px; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical; line-height: 1.6; }
.model-picker { margin-top: 12px; border: 1px solid #e3e8e4; border-radius: 8px; padding: 12px; background: #fafcfb; }
.mp-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.mp-head input { margin-left: auto; min-width: 180px; padding: 7px 10px; border: 1px solid #d6ddd8; border-radius: 6px; font-size: 13px; font-family: inherit; }
.model-list { max-height: 340px; overflow-y: auto; border-top: 1px solid #eef1ef; padding-top: 6px; }
.mp-group { font-size: 12px; color: #6d7d73; font-weight: 600; margin: 10px 0 5px; letter-spacing: .3px; }
.mp-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.mp-item:hover { background: #f0f5f2; }
.mp-item.picked { background: #eaf3ed; }
.mp-name { font-size: 13px; color: #26362d; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-provider { margin-top: 10px; }
.add-provider summary { cursor: pointer; color: #3f6b55; font-size: 14px; font-weight: 600; }
.add-provider[style] summary { color: #3f6b55; }
select { width: 100%; padding: 9px 11px; border: 1px solid #d6dbd5; border-radius: 6px;
         font-size: 13px; background: #fcfdfc; color: #243329; }
select:focus { outline: none; border-color: #3f6b55; }
.style-row { display: flex; align-items: flex-end; gap: 14px; }
.style-row label { flex: 1; }
.btn.small { padding: 7px 14px; font-size: 12px; }

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.theme-card { background: #fff; border: 1px solid #e5e7e2; border-radius: 10px; overflow: hidden; }
.theme-card-head { display: flex; justify-content: space-between; align-items: center;
                   padding: 14px 16px; border-bottom: 1px solid #eef0ec; }
.theme-card-head h3 { font-size: 15px; color: #243329; }
.theme-card-head p { font-size: 11px; margin-top: 2px; }
.theme-card iframe { width: 100%; height: 620px; border: 0; display: block; background: #fff; }

ul.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
ul.steps li { padding: 6px 12px; border-radius: 6px; font-size: 12px; }
ul.steps li.ok { background: #e5f2ea; color: #2f6b48; }
ul.steps li.err { background: #f9e5e3; color: #a33a30; }
.logs { background: #1d2b24; border-radius: 8px; padding: 16px; max-height: 340px; overflow: auto; }
.logline { font-family: 'Courier New', monospace; font-size: 12px; color: #c3d3c8; padding: 2px 0; }
.logline span { color: #7fa289; margin-right: 10px; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; background: #fff; border: 1px solid #e5e7e2; border-radius: 14px;
              padding: 40px 36px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.05); }
.login-brand { margin-bottom: 16px; }
.login-card h1 { font-size: 22px; }
.login-card p.muted { margin: 6px 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input { padding: 12px; border: 1px solid #d6dbd5; border-radius: 7px; font-size: 14px; }
.login-card button { padding: 12px; background: #2f4f43; color: #fff; border: none;
                     border-radius: 7px; font-size: 14px; cursor: pointer; }
.login-card .error { color: #a33a30; font-size: 12px; margin-top: 14px; }

/* 分步仿写工作台 */
.wb-toolbar { padding: 22px 24px 18px; }
.wb-topform { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.wb-urllabel { flex: 1; min-width: 320px; display: flex; flex-direction: column; gap: 8px;
               font-size: 13px; font-weight: 600; color: #3a423c; letter-spacing: .3px; }
#wbUrl { width: 100%; box-sizing: border-box; padding: 13px 16px; border: 1.5px solid #d6dbd5;
         border-radius: 9px; font-size: 15px; color: #16211b; background: #fafbf9;
         transition: border-color .15s, box-shadow .15s, background .15s; }
#wbUrl::placeholder { color: #b3bab4; }
#wbUrl:focus { outline: none; border-color: #3f6b55; background: #fff;
               box-shadow: 0 0 0 3px rgba(47,79,67,.12); }
.wb-topbtns { display: flex; gap: 10px; flex-wrap: wrap; padding-bottom: 1px; }
.wb-topbtns .btn { white-space: nowrap; font-size: 14px; padding: 12px 22px; border-radius: 9px;
                   display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 1px 2px rgba(22,33,27,.08);
                   transition: transform .1s, box-shadow .15s, background .15s; }
.wb-topbtns .btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(22,33,27,.14); }
.wb-topbtns .btn:active { transform: translateY(0); }
.wb-topbtns .btn.primary { padding: 12px 26px; }
.wb-step { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px;
           border-radius: 50%; background: rgba(255,255,255,.22); font-size: 12px; font-weight: 700; }
.wb-topbtns .btn:not(.primary) .wb-step { background: #eef2ee; color: #2f4f43; }
#wbMode { padding: 12px 14px; border: 1.5px solid #d6dbd5; border-radius: 9px; background: #fafbf9;
          font-size: 14px; color: #3a423c; cursor: pointer; box-shadow: 0 1px 2px rgba(22,33,27,.08); }
#wbMode:focus { outline: none; border-color: #3f6b55; background: #fff;
                box-shadow: 0 0 0 3px rgba(47,79,67,.12); }
.wb-msg { min-height: 20px; font-size: 12px; color: #7d857f; margin: 10px 0 6px; }
.wb-msg.ok { color: #2f6b48; }
.wb-msg.err { color: #a33a30; }
.wb-two { grid-template-columns: 1fr 1fr; align-items: stretch; }
.wb-pane { min-height: 560px; display: flex; flex-direction: column; }
.wb-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
                border-bottom: 1px solid #eef0ec; padding-bottom: 10px; margin-bottom: 14px; }
.wb-status { font-size: 12px; color: #8a8a84; }
.wb-pane-body { flex: 1; max-height: 680px; overflow-y: auto; }
.wb-empty { padding: 60px 20px; text-align: center; color: #a0a8a2; font-size: 13px; }
.wb-ttl { font-family: Georgia,'Songti SC',serif; font-size: 20px; color: #16211b; line-height: 1.5; margin-bottom: 4px; }
.wb-account { color: #9a9a96; font-size: 12px; margin-bottom: 18px; }
.wb-paras p { font-size: 14px; line-height: 2; color: #3a423c; margin-bottom: 12px; }
.wb-sub { font-size: 13px; color: #5d675f; margin: 22px 0 10px; padding-top: 14px; border-top: 1px dashed #dfe3dd; }
.wb-imgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.wb-imgcard { border: 1px solid #e6e9e4; border-radius: 7px; overflow: hidden; background: #fafbf9; }
.wb-imgcard img { width: 100%; display: block; max-height: 180px; object-fit: cover; }
.wb-imgbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; background: #fff; }
.wb-edit-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.wb-edit-tools .muted { font-size: 12px; }
.wb-editor { border: 1px solid #d6dbd5; border-radius: 7px; padding: 18px 20px; background: #fff;
             min-height: 480px; outline: none; font-size: 14px; line-height: 1.9; color: #333; }
.wb-editor:focus { border-color: #3f6b55; }
.wb-editor img { max-width: 100%; height: auto; }
.wb-editor p, .wb-editor section { margin: 0 0 10px; }
.modal { position: fixed; inset: 0; background: rgba(20,28,24,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { width: min(720px, 92vw); background: #fff; border-radius: 12px; padding: 20px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head strong { font-size: 16px; }
.modal-x { border: 0; background: none; font-size: 22px; cursor: pointer; color: #7d857f; line-height: 1; }
.crop-stage { position: relative; display: inline-block; margin: 12px 0; max-width: 100%; overflow: hidden; }
.crop-stage img { display: block; max-width: 100%; max-height: 440px; user-select: none; cursor: crosshair; }
.crop-box { position: absolute; border: 2px solid #2f81f7; background: rgba(47,129,247,.18); pointer-events: none; display: none; }
#cropCanvas { display: none; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-foot .muted { font-size: 12px; }

/* IP 白名单提示块 */
.ipbox { margin-top: 16px; padding: 14px 16px; border: 1px solid #dfe3dd; border-radius: 9px; background: #fafbf9; }
.ipbox-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ipbox-head strong { font-size: 14px; color: #16211b; }
.ipbox-head .muted { font-size: 12px; }
.ipbox-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ipbox-row code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 600;
                  color: #16211b; background: #fff; border: 1px solid #dfe3dd; border-radius: 7px;
                  padding: 9px 14px; letter-spacing: .5px; }


@media (max-width: 800px) {
  .wb { grid-template-columns: 1fr; }

  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 14px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .app { flex-direction: column; }
  .main { padding: 20px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr; }
  .style-row { flex-direction: column; align-items: stretch; }
}
