* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
    min-height: 100vh;
}

/* Nav */
.nav {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
}

.nav-brand {
    font-weight: 700;
    font-size: 18px;
    color: #1a1a1a;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 16px;
}

.nav-links a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #0088cc;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.container h1 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #1a1a1a;
}

/* Status */
.status-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-align: center;
}

.sugar-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sugar-icon {
    font-size: 32px;
}

.sugar-number {
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
}

.sugar-unit {
    font-size: 14px;
    color: #888;
    align-self: flex-end;
    margin-bottom: 10px;
}

.sugar-normal { color: #34c759; }
.sugar-high { color: #ff9500; }
.sugar-low { color: #ff9500; }
.sugar-critical-high { color: #ff3b30; }
.sugar-critical-low { color: #ff3b30; }

.trend-line {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.status-message {
    font-size: 16px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #f8f8f8;
}

.info-line {
    font-size: 14px;
    color: #666;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.error-card, .empty-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-align: center;
    color: #888;
}

.error-card .btn, .empty-card .btn {
    display: inline-block;
    margin-top: 12px;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    max-width: 380px;
    width: 100%;
    margin: 40px 16px;
    text-align: center;
}

.login-header {
    margin-bottom: 28px;
}

.login-header .logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.login-header p {
    color: #888;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-form input {
    font-size: 20px;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
}

.login-form input:focus {
    border-color: #0088cc;
}

.login-form button {
    font-size: 16px;
    font-weight: 600;
    padding: 14px;
    background: #0088cc;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.login-form button:hover {
    background: #0077b3;
}

.login-hint {
    margin-top: 24px;
    font-size: 13px;
    color: #999;
    line-height: 1.5;
}

.login-hint strong {
    color: #666;
}

/* Settings */
.settings-form {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.field input {
    width: 100%;
    font-size: 15px;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.field input:focus {
    border-color: #0088cc;
}

.settings-form button {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    padding: 12px;
    background: #0088cc;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.settings-form button:hover {
    background: #0077b3;
}

/* Status messages */
.error {
    background: #fff0f0;
    color: #d32f2f;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 12px;
}

.success {
    background: #f0fff4;
    color: #2e7d32;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 12px;
}

.hidden {
    display: none;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #bbb;
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

/* Bot link */
.bot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid #0088cc;
    border-radius: 12px;
    color: #0088cc;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
    margin-bottom: 16px;
}

.bot-link:hover {
    background: #0088cc;
    color: #ffffff;
}

/* QR code */
.qr-section {
    margin-bottom: 16px;
}

.qr-code {
    border-radius: 12px;
    border: 2px solid #eee;
}

/* Mobile */
@media (max-width: 480px) {
    .container { padding: 16px 12px 40px; }
    .sugar-number { font-size: 44px; }
    .status-card { padding: 24px 16px; }
    .settings-form { padding: 16px; }
    .login-card { padding: 32px 24px; margin: 20px 12px; }
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.action-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.action-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.action-desc {
    font-size: 12px;
    color: #999;
}

/* Calc card */
.calc-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.calc-sugar {
    font-size: 18px;
    font-weight: 600;
    padding: 10px 0;
    color: #555;
}

.calc-result {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
}

.dose-result {
    font-size: 20px;
    color: #0088cc;
    text-align: center;
    margin-top: 4px;
}

/* Buttons */
.btn-primary {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    padding: 12px;
    background: #0088cc;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    background: #0077b3;
}

.btn {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    background: #0088cc;
    color: #ffffff;
    border-radius: 10px;
    text-decoration: none;
}

.btn:hover {
    background: #0077b3;
}
