/* assets/css/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green: #1d9e75;
    --green-light: #e1f5ee;
    --blue: #185fa5;
    --blue-light: #e6f1fb;
    --amber: #854f0b;
    --amber-light: #faeeda;
    --red: #a32d2d;
    --red-light: #fcebeb;
    --gray: #5f5e5a;
    --gray-light: #f1efe8;
    --border: #e2e0d8;
    --text: #1a1a18;
    --text-muted: #6b6a66;
    --bg: #f8f7f2;
    --sidebar-w: 220px;
    --radius: 8px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 100; }
.sidebar-logo { padding: 20px 18px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--border); }
.sidebar-nav { list-style: none; flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav a { display: block; padding: 10px 18px; color: var(--text-muted); text-decoration: none; border-radius: 0; transition: background 0.1s, color 0.1s; }
.sidebar-nav a:hover { background: var(--gray-light); color: var(--text); }
.sidebar-nav a.active { background: var(--green-light); color: var(--green); font-weight: 500; }
.sidebar-footer { padding: 16px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }
.sidebar-footer a { color: var(--text-muted); text-decoration: none; }
.sidebar-footer a:hover { color: var(--red); }

/* Main */
.main-content { margin-left: var(--sidebar-w); padding: 28px 32px; min-height: 100vh; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 600; }

/* Auth */
.auth-page { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 36px; width: 100%; max-width: 400px; }
.auth-logo { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.auth-title { font-size: 18px; font-weight: 600; margin-bottom: 24px; }

/* Cards */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.mt-4 { margin-top: 24px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-icon.green { background: var(--green-light); }
.stat-icon.blue  { background: var(--blue-light); }
.stat-icon.amber { background: var(--amber-light); }
.stat-icon.red   { background: var(--red-light); }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Workflow grid */
.workflow-grid { display: flex; flex-direction: column; gap: 12px; }
.workflow-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--gray-light); border-radius: var(--radius); }
.workflow-icon { font-size: 20px; }
.workflow-name { font-weight: 500; font-size: 14px; }
.workflow-count { font-size: 12px; color: var(--text-muted); }
.workflow-item .badge { margin-left: auto; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green   { background: var(--green-light); color: var(--green); }
.badge-blue    { background: var(--blue-light); color: var(--blue); }
.badge-amber   { background: var(--amber-light); color: var(--amber); }
.badge-red     { background: var(--red-light); color: var(--red); }
.badge-success { background: #d4edda; color: #155724; }
.badge-muted   { background: var(--gray-light); color: var(--gray); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-light); }
tr.row-danger td { background: #fff8f8; }
.msg-preview { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background 0.1s; }
.btn:hover { background: var(--gray-light); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: #0f6e56; }
.btn-success { background: var(--green-light); color: var(--green); border-color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; background: #fff; color: var(--text); font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.select-sm { padding: 4px 8px; font-size: 12px; border-radius: 6px; }

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; text-decoration: none; color: var(--text-muted); background: #fff; border: 1px solid var(--border); }
.filter-btn:hover { background: var(--gray-light); }
.filter-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; padding: 28px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 17px; font-weight: 600; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-danger  { background: var(--red-light); color: var(--red); }

/* Misc */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
