:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #ecfdf5;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    --header-h: 56px;
    --bottom-nav-h: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px;
}

.header {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header .datetime {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
}

.nav {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.nav a {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    background: var(--surface);
    text-decoration: none;
    color: var(--primary);
    text-align: center;
    border-radius: var(--radius-sm);
    font-weight: 500;
    border: 1px solid var(--border);
    font-size: 14px;
}

.nav a:hover,
.nav a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.content h2 {
    font-size: 17px;
    margin-bottom: 12px;
    color: var(--text);
}

.btn {
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-bottom: 8px;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: var(--surface);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

.table th,
.table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.alert {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--surface);
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    font-size: 14px;
    min-height: 44px;
}

.btn-back:hover {
    color: var(--text);
    border-color: var(--primary);
}

.btn-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 480px) {
    .btn-row {
        flex-direction: row;
    }

    .btn-row .btn {
        width: auto;
        flex: 1;
        margin-bottom: 0;
    }
}

.item-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: var(--surface);
}

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.item-card-name {
    font-weight: 600;
    font-size: 15px;
}

.item-card-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.4;
}

.item-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-height: 36px;
}

.btn-sm-edit {
    background: var(--primary);
    color: white;
}

.btn-sm-delete {
    background: var(--danger-light);
    color: var(--danger);
}

.summary-box {
    background: var(--bg);
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.platform-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 8px 10px;
    background: var(--surface);
    border-radius: 6px;
    font-size: 13px;
}

.section-title {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 200;
    box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    min-height: 44px;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav a span.icon {
    font-size: 20px;
    line-height: 1;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 16px;
    font-size: 14px;
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }

    .bottom-nav {
        display: none;
    }

    .header h1 {
        font-size: 20px;
    }

    .container {
        padding: 16px;
    }
}

@media print {
    body {
        background: white;
        padding-bottom: 0;
    }

    .no-print,
    .bottom-nav,
    .header {
        display: none !important;
    }
}
