* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft YaHei", Arial, sans-serif;
    color: #333;
    background: linear-gradient(135deg, #00D6B8 0 35%, #FFEF02 35% 70%, #FF4C02 70% 100%);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    padding: 34px;
    border: 4px solid #fff;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 12px 12px 0 #FF4C02;
}

.login-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    display: block;
    margin-bottom: 16px;
}

.login-card h1,
.admin-header h1,
.admin-menu h2,
.panel-title h2 {
    margin: 0;
    letter-spacing: 3px;
}

.login-tip,
.admin-header p,
.panel-title p {
    color: #666;
    line-height: 1.7;
}

.login-form label {
    display: block;
    margin: 18px 0;
    font-weight: bold;
}

.login-form input,
.field-card input,
.field-card textarea,
.menu-edit-card input {
    width: 100%;
    margin-top: 8px;
    padding: 12px 14px;
    border: 2px solid #00D6B8;
    border-radius: 0;
    font: inherit;
    background: #fff;
}

button,
.logout,
.menu-button {
    border: 0;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
}

button {
    width: 100%;
    padding: 14px 18px;
    color: #fff;
    background: #FF4C02;
    font-size: 18px;
}

.alert {
    padding: 12px 14px;
    margin: 16px 0;
    font-weight: bold;
}

.alert.error {
    color: #fff;
    background: #d93025;
}

.alert.success {
    color: #045b4f;
    background: #b9fff5;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 6px solid #FFEF02;
}

.brand {
    position: relative;
    min-height: 82px;
    padding-left: 170px;
}

.brand img {
    position: absolute;
    left: 0;
    top: -22px;
    width: 150px;
    height: 150px;
    object-fit: contain;
}

.brand > div {
    padding-top: 8px;
}

.logout {
    padding: 12px 18px;
    color: #fff;
    background: #FF4C02;
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    padding: 24px;
}

.admin-top-actions{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
}

.admin-menu,
.editor-panel {
    border: 4px solid #fff;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.12);
}

.admin-menu {
    padding: 20px;
    align-self: start;
    position: sticky;
    top: 20px;
}

.sub-tabs{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
    margin:18px 0 8px;
}

.sub-tabs a{
    padding:10px 16px;
    border:2px solid #00D6B8;
    background:#fff;
    color:#333;
    font-weight:bold;
}

.sub-tabs a.active,
.sub-tabs a:hover{
    background:#00D6B8;
}

.menu-card-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
    margin-top:18px;
}

.input-required-flash{
    border-color:#ff4c02 !important;
    box-shadow:0 0 0 3px rgba(255,76,2,.18);
    transition:box-shadow .2s ease,border-color .2s ease;
}

.menu-edit-card{
    min-width:0;
    padding:18px;
    border:3px solid #00D6B8;
    background:#fff;
    box-shadow:6px 6px 0 rgba(0,0,0,.08);
}

.menu-edit-card h3{
    margin:0 0 14px;
}

.inline-row{
    display:grid;
    grid-template-columns:minmax(110px,1fr) auto;
    gap:12px;
    align-items:end;
}

.inline-row label{
    min-width:0;
    display:block;
    font-weight:bold;
}

.short-input{
    width:100%;
    margin-top:8px;
}

.check-label{
    display:flex!important;
    align-items:center;
    gap:8px;
    padding-bottom:4px;
}

.check-label input{
    width:auto;
    margin:0;
}

.url-holder.disabled{
    opacity:.45;
}

.url-holder{
    grid-column:1 / -1;
    min-width:0;
}

.submenu-edit-form .menu-edit-card{
    grid-column:1/-1;
}

.submenu-row{
    display:grid;
    grid-template-columns:70px 160px 1fr 44px 44px;
    gap:10px;
    align-items:center;
    margin:10px 0;
}

.submenu-row span{
    font-weight:bold;
    color:#00a48d;
}

.row-btn{
    width:44px;
    height:44px;
    line-height:40px;
    padding:0;
    border:2px solid #00D6B8;
    background:#FFEF02;
    color:#333;
}

.row-btn.minus{
    background:#FF4C02;
    color:#fff;
}

.thing-search-form{
    display:flex;
    gap:12px;
    align-items:center;
    margin:18px 0 22px;
}

.thing-search-form input{
    flex:1;
    min-width:0;
    margin-top:0;
}

.thing-search-form button{
    width:auto;
    min-width:120px;
}

.thing-admin-table-wrap{
    overflow:auto;
}

.thing-admin-table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
}

.thing-admin-table th,
.thing-admin-table td{
    padding:12px;
    border-bottom:1px solid #ddd;
    vertical-align:top;
    text-align:left;
}

.thing-admin-table thead th{
    background:#00D6B8;
    color:#fff;
}

.thing-admin-table img{
    width:88px;
    height:66px;
    object-fit:cover;
    display:block;
    border:2px solid #fff;
    box-shadow:4px 4px 0 rgba(0,0,0,.08);
}

.thing-actions{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.mini-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:auto;
    padding:8px 12px;
    background:#00D6B8;
    color:#fff;
    font-size:14px;
    letter-spacing:1px;
}

.mini-btn.warn{
    background:#FFEF02;
    color:#333;
}

.mini-btn.danger{
    background:#FF4C02;
    color:#fff;
}

.thing-publish-form .thing-param-editor{
    padding:18px 0;
    border-bottom:1px dashed #ccc;
}

.param-rows{
    display:flex;
    flex-direction:column;
    gap:12px;
    margin-top:14px;
}

.param-row{
    display:grid;
    grid-template-columns:1fr 1fr 44px 44px;
    gap:10px;
    align-items:center;
}

.param-row input{
    width:100%;
    margin-top:0;
}

.param-row .row-btn{
    width:44px;
    height:44px;
}

.download-category-add,
.download-category-select{
    display:grid;
    grid-template-columns:1fr auto;
    gap:12px;
    align-items:end;
    margin:18px 0 22px;
}

.download-category-add input,
.download-category-select select,
.download-item-table input{
    width:100%;
    padding:12px 14px;
    border:2px solid #00D6B8;
    font:inherit;
    background:#fff;
}

.download-category-select label{
    display:block;
    font-weight:bold;
}

.download-category-select select{
    margin-top:8px;
}

.download-category-add button,
.download-category-select button{
    width:auto;
    min-width:130px;
}

.download-category-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
    margin-top:18px;
}

.download-category-card{
    min-width:0;
    padding:18px;
    border:3px solid #00D6B8;
    background:#fff;
    box-shadow:6px 6px 0 rgba(0,0,0,.08);
}

.download-category-card strong{
    display:block;
    min-height:56px;
    line-height:1.55;
    font-size:22px;
    letter-spacing:3px;
    word-break:break-all;
}

.download-category-order{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:46px;
    margin-right:10px;
    padding:2px 6px;
    background:#FFEF02;
    color:#333;
    font-size:14px;
    letter-spacing:1px;
    vertical-align:middle;
}

.download-category-card small{
    display:block;
    margin:10px 0 14px;
    color:#00a48d;
    font-weight:bold;
}

.download-category-card input{
    width:100%;
    margin:0 0 10px;
    padding:12px 14px;
    border:2px solid #00D6B8;
    font:inherit;
}

.download-card-actions{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    gap:8px;
}

.download-card-actions.single{
    grid-template-columns:1fr;
}

.download-card-actions form{
    margin:0;
}

.download-category-card form[id^="cat-up-"],
.download-category-card form[id^="cat-down-"],
.download-category-card form[id^="cat-delete-"]{
    display:none;
}

.download-category-card .category-save-form{
    display:block;
}

.icon-btn{
    width:100%;
    min-width:0;
    padding:9px 8px;
    background:#00D6B8;
    color:#fff;
    font-size:14px;
    letter-spacing:1px;
}

.icon-btn.save,
.icon-btn.add{
    background:#FFEF02;
    color:#333;
}

.icon-btn.danger{
    background:#FF4C02;
}

.icon-btn:disabled{
    cursor:not-allowed;
    background:#d8d8d8;
    color:#888;
}

.download-item-table td{
    vertical-align:middle;
}

.download-item-table a{
    color:#00a48d;
    word-break:break-all;
}

.download-new-row td{
    background:#fff6c2;
}

.pager{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:18px;
}

.pager a{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:38px;
    height:38px;
    padding:0 10px;
    border:2px solid #00D6B8;
    background:#fff;
    font-weight:bold;
}

.pager a.active,
.pager a:hover{
    background:#FF4C02;
    color:#fff;
    border-color:#FF4C02;
}

.menu-button {
    display: block;
    margin-top: 14px;
    padding: 14px 16px;
    background: #00D6B8;
    color: #fff;
}

.menu-button.active,
.menu-button:hover {
    background: #FF4C02;
}

.menu-button.preview {
    margin-top: 28px;
    background: #FFEF02;
    color: #333;
}

.editor-panel {
    padding: 24px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 3px solid #00D6B8;
}

.count-badge {
    padding: 10px 14px;
    background: #FFEF02;
    font-weight: bold;
    white-space: nowrap;
}

.field-card {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 18px;
    padding: 20px 0;
    border-bottom: 1px dashed #ccc;
}

.field-card.compact{
    grid-template-columns:220px 1fr;
    align-items:center;
}

.field-card.compact input{
    margin-top:0;
}

.field-meta strong,
.field-meta span,
.field-meta em {
    display: block;
    line-height: 1.7;
}

.field-meta span {
    color: #00a48d;
    font-family: Consolas, monospace;
}

.field-meta em {
    color: #777;
    font-style: normal;
}

.form-actions {
    position: sticky;
    bottom: 0;
    padding: 18px 0 0;
    background: rgba(255, 255, 255, 0.96);
}

.empty-state {
    padding: 28px;
    margin-top: 20px;
    background: #fff6c2;
    border: 2px dashed #FF4C02;
}

.admin-menu .menu-button{
    white-space:normal;
    line-height:1.4;
}

.admin-menu .menu-button.active,
.admin-menu .menu-button:hover{
    transform:translateX(4px);
}

@media (max-width: 860px) {
    .admin-header,
    .panel-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .brand{
        min-height: 0;
        padding-left: 0;
    }

    .brand img{
        position: static;
        width: 96px;
        height: 96px;
        margin-bottom: 8px;
    }

    .admin-shell,
    .field-card {
        grid-template-columns: 1fr;
    }

    .menu-card-grid{
        grid-template-columns:1fr;
    }

    .download-category-grid,
    .download-category-add,
    .download-category-select{
        grid-template-columns:1fr;
    }

    .inline-row,
    .submenu-row{
        grid-template-columns:1fr;
    }

    .thing-search-form,
    .thing-actions{
        flex-direction:column;
        align-items:stretch;
    }

    .thing-search-form button,
    .mini-btn{
        width:100%;
    }

    .param-row{
        grid-template-columns:1fr 1fr;
    }

    .admin-menu {
        position: static;
    }
}